Skip to content

Commit

Permalink
[PPD-206] fix services int-test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopocarlini committed Jul 4, 2022
1 parent 739d440 commit 64f27ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Feature: All about Services

Background:
Given GPS running

Scenario: success services list
Given some services in the DB
When the client get all services
Expand All @@ -8,10 +11,9 @@ Feature: All about Services

Scenario: get service with success
Given some services in the DB
When the client get service "d"
When the client get service "service-1"
Then the client receives status code of 200

Scenario: service not found
Given no services in the DB
When the client get service 1
When the client get service "service-not-found"
Then the client receives status code of 404
10 changes: 3 additions & 7 deletions integration-test/step_definitions/support/services_steps.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const assert = require('assert')
const {Given, When, Then} = require('@cucumber/cucumber')
const {get} = require("./common");
const {getServices, getService} = require("./gps_client");

let responseToCheck;
let service;


// Given
Expand All @@ -16,21 +15,18 @@ Given('some services in the DB', function () {
// When

When('the client get service {string}', async function (idService) {
service = await get(`/services/${idService}`);
responseToCheck = await getService(idService);
});


When('the client get all services', async function () {
responseToCheck = await get('/services');
responseToCheck = await getServices();
});


// Then

Then('the client receives status code of {int}', function (statusCode) {
assert.strictEqual(responseToCheck.status, statusCode);
});

Then(/^the client retrieves the list of services$/, function () {
assert.notStrictEqual(responseToCheck.data.length, 0);
});

0 comments on commit 64f27ff

Please sign in to comment.