You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expects HTTP response to return a JSON collection (can be empty or contain the specified minimum and/or maximum number of items). The `utils.expect.response.many` function can be called via one of these shortcuts:
386
386
387
387
*[`utils.expect.response.empty`](#utilsexpectresponseempty) to check for an empty collection
388
-
*[`utils.expect.response.nonempty`](#utilsexpectresponsenonempty) to check for a non-empty collection
388
+
*[`utils.expect.response.not.empty`](#utilsexpectresponsenotempty) to check for a non-empty collection
389
389
*[`utils.expect.response.unique`](#utilsexpectresponseunique) to check for a collection with a single (unique) item
390
390
391
391
#### Prototype
@@ -419,45 +419,45 @@ Check if the HTTP response data contains an empty JSON collection (but not `null
419
419
utils.expect.response.empty(pm);
420
420
```
421
421
422
-
### `utils.expect.response.nonempty`
423
-
Expects HTTP response to return a non-empty JSON collection (one or more items).
422
+
### `utils.expect.response.unique`
423
+
Expects HTTP response to return a JSON collection with a single element (but not a single element matching the condition of the utils.expect.response.one function).
424
424
425
425
#### Prototype
426
426
```JavaScript
427
-
utils.expect.response.nonempty(pm)
427
+
utils.expect.response.unique(pm)
428
428
```
429
429
430
430
#### Example
431
-
Check if the HTTP response data contains a JSON collection with at least one item.
431
+
Check if the HTTP response contains a JSON collection with a single element.
432
+
432
433
```JavaScript
433
-
utils.expect.response.nonempty(pm);
434
+
utils.expect.response.unique(pm);
434
435
```
435
436
436
-
### `utils.expect.response.unique`
437
-
Expects HTTP response to return a JSON collection with a single element (but not a single element matching the condition of the utils.expect.response.one function).
437
+
### `utils.expect.response.not.empty`
438
+
Expects HTTP response to return a non-empty JSON collection (one or more items).
438
439
439
440
#### Prototype
440
441
```JavaScript
441
-
utils.expect.response.unique(pm)
442
+
utils.expect.response.not.empty(pm)
442
443
```
443
444
444
445
#### Example
445
-
Check if the HTTP response contains a JSON collection with a single element.
446
-
446
+
Check if the HTTP response data contains a JSON collection with at least one item.
447
447
```JavaScript
448
-
utils.expect.response.unique(pm);
448
+
utils.expect.response.not.empty(pm);
449
449
```
450
450
451
451
## Property validation functions
452
452
Property validation functions check named properties of the specified objects. The primary benefits of these functions (compared to the underlying [Chai assertions](https://www.chaijs.com/api/bdd/) they use) is that they (a) always check to make sure that the properties exist before additional validation (so you can skip one test step) and (b) generate more complete error messages on assertion failures (the default assertion errors do not mention named of the properties being checked, which makes them not that useful). Property validation functions are grouped under the `utils.expect.property` namespace and include:
Check if the JSON object returned in the HTTP response contains the string property `name` holding the value that doe not match a regular expression `/^John$/`.
Trace functions print trace messages that can indicate the start and end of pre-request and test script execution. You can also customize trace function to print your custom trace messages.
0 commit comments