@cuppet/core 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,6 +22,9 @@ Given('the response code should be {string}', async function (code) {
|
|
|
22
22
|
Then('the response should be an {string}', async function (type) {
|
|
23
23
|
await apiSteps.validateResponseType(type);
|
|
24
24
|
});
|
|
25
|
+
Then('the response should be an empty array', async function () {
|
|
26
|
+
await apiSteps.validateResponseIsEmptyArray();
|
|
27
|
+
});
|
|
25
28
|
Then('the property {string} should be an {string}', async function (property, type) {
|
|
26
29
|
await apiSteps.propertyIs(property, type);
|
|
27
30
|
});
|
package/package.json
CHANGED
package/src/apiFunctions.js
CHANGED
|
@@ -196,7 +196,16 @@ module.exports = {
|
|
|
196
196
|
* @returns {Promise<void>}
|
|
197
197
|
*/
|
|
198
198
|
validateResponseType: async function (type) {
|
|
199
|
-
|
|
199
|
+
assert.typeOf(this.response.data, type, `Response is not an ${type}`);
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Validate that the response body is an empty array
|
|
204
|
+
* @returns {Promise<void>}
|
|
205
|
+
*/
|
|
206
|
+
validateResponseIsEmptyArray: async function () {
|
|
207
|
+
assert.isArray(this.response.data, 'Response is not an array');
|
|
208
|
+
assert.isEmpty(this.response.data, `Expected an empty array but got ${JSON.stringify(this.response.data)}`);
|
|
200
209
|
},
|
|
201
210
|
|
|
202
211
|
/**
|