@serenity-js/assertions 3.25.0 → 3.25.1
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.
- package/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/lib/Ensure.d.ts +18 -20
- package/lib/Ensure.d.ts.map +1 -1
- package/lib/Ensure.js +18 -20
- package/lib/Ensure.js.map +1 -1
- package/lib/EnsureEventually.d.ts +9 -9
- package/lib/EnsureEventually.js +9 -9
- package/lib/expectations/and.d.ts +1 -1
- package/lib/expectations/and.js +1 -1
- package/lib/expectations/contain.d.ts +1 -1
- package/lib/expectations/contain.js +1 -1
- package/lib/expectations/containAtLeastOneItemThat.d.ts +1 -1
- package/lib/expectations/containAtLeastOneItemThat.js +1 -1
- package/lib/expectations/containItemsWhereEachItem.d.ts +1 -1
- package/lib/expectations/containItemsWhereEachItem.js +1 -1
- package/lib/expectations/endsWith.d.ts +1 -1
- package/lib/expectations/endsWith.js +1 -1
- package/lib/expectations/equals.d.ts +1 -1
- package/lib/expectations/equals.js +1 -1
- package/lib/expectations/includes.d.ts +2 -2
- package/lib/expectations/includes.js +2 -2
- package/lib/expectations/isAfter.d.ts +1 -1
- package/lib/expectations/isAfter.js +1 -1
- package/lib/expectations/isBefore.d.ts +1 -1
- package/lib/expectations/isBefore.js +1 -1
- package/lib/expectations/isCloseTo.d.ts +1 -1
- package/lib/expectations/isCloseTo.js +1 -1
- package/lib/expectations/isFalse.d.ts +1 -1
- package/lib/expectations/isFalse.js +1 -1
- package/lib/expectations/isGreaterThan.d.ts +1 -1
- package/lib/expectations/isGreaterThan.js +1 -1
- package/lib/expectations/isLessThan.d.ts +1 -1
- package/lib/expectations/isLessThan.js +1 -1
- package/lib/expectations/isPresent.d.ts +4 -3
- package/lib/expectations/isPresent.d.ts.map +1 -1
- package/lib/expectations/isPresent.js +4 -3
- package/lib/expectations/isPresent.js.map +1 -1
- package/lib/expectations/isTrue.d.ts +1 -1
- package/lib/expectations/isTrue.js +1 -1
- package/lib/expectations/matches.d.ts +1 -1
- package/lib/expectations/matches.js +1 -1
- package/lib/expectations/not.d.ts +1 -1
- package/lib/expectations/not.js +1 -1
- package/lib/expectations/or.d.ts +1 -1
- package/lib/expectations/or.js +1 -1
- package/lib/expectations/property.d.ts +1 -1
- package/lib/expectations/property.js +1 -1
- package/lib/expectations/startsWith.d.ts +1 -1
- package/lib/expectations/startsWith.js +1 -1
- package/package.json +3 -3
- package/src/Ensure.ts +18 -20
- package/src/EnsureEventually.ts +9 -9
- package/src/expectations/and.ts +1 -1
- package/src/expectations/contain.ts +1 -1
- package/src/expectations/containAtLeastOneItemThat.ts +1 -1
- package/src/expectations/containItemsWhereEachItem.ts +1 -1
- package/src/expectations/endsWith.ts +1 -1
- package/src/expectations/equals.ts +1 -1
- package/src/expectations/includes.ts +2 -2
- package/src/expectations/isAfter.ts +1 -1
- package/src/expectations/isBefore.ts +1 -1
- package/src/expectations/isCloseTo.ts +1 -1
- package/src/expectations/isFalse.ts +1 -1
- package/src/expectations/isGreaterThan.ts +1 -1
- package/src/expectations/isLessThan.ts +1 -1
- package/src/expectations/isPresent.ts +4 -3
- package/src/expectations/isTrue.ts +1 -1
- package/src/expectations/matches.ts +1 -1
- package/src/expectations/not.ts +1 -1
- package/src/expectations/or.ts +1 -1
- package/src/expectations/property.ts +1 -1
- package/src/expectations/startsWith.ts +1 -1
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isPresent = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
/**
|
|
6
|
-
* Creates an
|
|
6
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the `actual` value is not undefined or null.
|
|
7
7
|
*
|
|
8
|
-
* Also, when the `actual` implements
|
|
9
|
-
*
|
|
8
|
+
* Also, when the `actual` implements [`Optional`](https://serenity-js.org/api/core/interface/Optional/),
|
|
9
|
+
* the expectation is met when calling [`Optional.isPresent`](https://serenity-js.org/api/core/interface/Optional/#isPresent)
|
|
10
|
+
* returns an [`Answerable`](https://serenity-js.org/api/core/#Answerable) that resolves to `true`
|
|
10
11
|
*
|
|
11
12
|
* ## Ensuring that a value is defined
|
|
12
13
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/expectations/isPresent.ts"],"names":[],"mappings":";;;AACA,4CAAuG;AAEvG
|
|
1
|
+
{"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/expectations/isPresent.ts"],"names":[],"mappings":";;;AACA,4CAAuG;AAEvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,SAAgB,SAAS;IACrB,OAAO,IAAI,SAAS,EAAU,CAAC;AACnC,CAAC;AAFD,8BAEC;AAED,MAAM,SAAkB,SAAQ,kBAAmB;IACvC,MAAM,CAAC,UAAU,CAAC,KAAU;QAChC,OAAO,KAAK,KAAK,SAAS;eACnB,KAAK,KAAK,IAAI;eACd,OAAO,KAAK,CAAC,SAAS,KAAK,UAAU,CAAC;IACjD,CAAC;IAEO,MAAM,CAAC,YAAY,CAAI,MAAqB,EAAE,KAAuB;QACzE,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC9B,OAAO,MAAM,CAAC;SACjB;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAI,KAAoB,EAAE,KAAuB;QAC3E,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;SAC1C;QAED,OAAO,KAAK,KAAK,SAAS;eACnB,KAAK,KAAK,IAAI,CAAC;IAC1B,CAAC;IAED;QACI,KAAK,CACD,WAAW,EACX,gBAAgB,EAChB,KAAK,EAAE,KAAuB,EAAE,MAA0B,EAAE,EAAE;YAE1D,MAAM,KAAK,GAAI,MAAM,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC3D,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAEvD,OAAO,MAAM;gBACT,CAAC,CAAC,IAAI,qBAAc,CAAC,gBAAgB,EAAE,yBAAkB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC;gBACxF,CAAC,CAAC,IAAI,wBAAiB,CAAC,gBAAgB,EAAE,yBAAkB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACpG,CAAC,CACJ,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* Creates an
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
4
4
|
* is `true`.
|
|
5
5
|
*
|
|
6
6
|
* ## Ensuring that a given value is true
|
|
@@ -4,7 +4,7 @@ exports.isTrue = void 0;
|
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
const equals_1 = require("./equals");
|
|
6
6
|
/**
|
|
7
|
-
* Creates an
|
|
7
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
8
8
|
* is `true`.
|
|
9
9
|
*
|
|
10
10
|
* ## Ensuring that a given value is true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* Creates an
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
4
4
|
* matches the `expected` regular expression.
|
|
5
5
|
*
|
|
6
6
|
* ## Ensuring that a given string matches a regular expression
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.matches = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
/**
|
|
6
|
-
* Creates an
|
|
6
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
7
7
|
* matches the `expected` regular expression.
|
|
8
8
|
*
|
|
9
9
|
* ## Ensuring that a given string matches a regular expression
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* Produces an
|
|
3
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that negates the provided `expectation`.
|
|
4
4
|
*
|
|
5
5
|
* ## Ensuring that the actual value does not equal the expected value
|
|
6
6
|
*
|
package/lib/expectations/not.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.not = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
/**
|
|
6
|
-
* Produces an
|
|
6
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that negates the provided `expectation`.
|
|
7
7
|
*
|
|
8
8
|
* ## Ensuring that the actual value does not equal the expected value
|
|
9
9
|
*
|
package/lib/expectations/or.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* Creates an
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when at least one of the `expectations` is met for the given actual value.
|
|
4
4
|
*
|
|
5
5
|
* Use `or` to combine several expectations using logical "or",
|
|
6
6
|
*
|
package/lib/expectations/or.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.or = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
/**
|
|
6
|
-
* Creates an
|
|
6
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when at least one of the `expectations` is met for the given actual value.
|
|
7
7
|
*
|
|
8
8
|
* Use `or` to combine several expectations using logical "or",
|
|
9
9
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* Creates an
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the value of
|
|
4
4
|
* the `actual[propertyName]` meets the `expectation`.
|
|
5
5
|
*
|
|
6
6
|
* ## Ensuring that an array has an item
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.property = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
/**
|
|
6
|
-
* Creates an
|
|
6
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the value of
|
|
7
7
|
* the `actual[propertyName]` meets the `expectation`.
|
|
8
8
|
*
|
|
9
9
|
* ## Ensuring that an array has an item
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* Creates an
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
4
4
|
* starts with the resolved value of `expected`.
|
|
5
5
|
*
|
|
6
6
|
* ## Ensuring that a given string starts with an expected substring
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.startsWith = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
/**
|
|
6
|
-
* Creates an
|
|
6
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
7
7
|
* starts with the resolved value of `expected`.
|
|
8
8
|
*
|
|
9
9
|
* ## Ensuring that a given string starts with an expected substring
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/assertions",
|
|
3
|
-
"version": "3.25.
|
|
3
|
+
"version": "3.25.1",
|
|
4
4
|
"description": "Screenplay-style assertion library",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"node": "^16.13 || ^18.12 || ^20"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@serenity-js/core": "3.25.
|
|
47
|
+
"@serenity-js/core": "3.25.1",
|
|
48
48
|
"tiny-types": "1.22.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"ts-node": "10.9.2",
|
|
58
58
|
"typescript": "5.2.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "450b994115cf9f1a1547ef92ac9387e0c57821ce"
|
|
61
61
|
}
|
package/src/Ensure.ts
CHANGED
|
@@ -23,10 +23,10 @@ import type { FileSystemLocation } from '@serenity-js/core/lib/io';
|
|
|
23
23
|
import { EnsureEventually } from './EnsureEventually';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* The
|
|
27
|
-
* verifies if the resolved value of the provided
|
|
28
|
-
* meets the specified
|
|
29
|
-
* If not, it throws an
|
|
26
|
+
* The [interaction](https://serenity-js.org/api/core/class/Interaction/) to `Ensure`
|
|
27
|
+
* verifies if the resolved value of the provided [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
28
|
+
* meets the specified [`Expectation`](https://serenity-js.org/api/core/class/Expectation/).
|
|
29
|
+
* If not, it throws an [`AssertionError`](https://serenity-js.org/api/core/class/AssertionError/).
|
|
30
30
|
*
|
|
31
31
|
* Use `Ensure` to verify the state of the system under test.
|
|
32
32
|
*
|
|
@@ -72,16 +72,16 @@ import { EnsureEventually } from './EnsureEventually';
|
|
|
72
72
|
export class Ensure<Actual> extends Interaction {
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* Creates an
|
|
76
|
-
* verifies if the resolved value of the provided
|
|
77
|
-
* meets the specified
|
|
78
|
-
* If not, it immediately throws an
|
|
75
|
+
* Creates an [interaction](https://serenity-js.org/api/core/class/Interaction/) to `Ensure`, which
|
|
76
|
+
* verifies if the resolved value of the provided [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
77
|
+
* meets the specified [`Expectation`](https://serenity-js.org/api/core/class/Expectation/).
|
|
78
|
+
* If not, it immediately throws an [`AssertionError`](https://serenity-js.org/api/core/class/AssertionError/).
|
|
79
79
|
*
|
|
80
80
|
* @param {Answerable<Actual_Type>} actual
|
|
81
|
-
* An
|
|
81
|
+
* An [`Answerable`](https://serenity-js.org/api/core/#Answerable) describing the actual state of the system.
|
|
82
82
|
*
|
|
83
83
|
* @param {Expectation<Actual_Type>} expectation
|
|
84
|
-
* An
|
|
84
|
+
* An [`Expectation`](https://serenity-js.org/api/core/class/Expectation/) you expect the `actual` value to meet
|
|
85
85
|
*
|
|
86
86
|
* @returns {Ensure<Actual_Type>}
|
|
87
87
|
*/
|
|
@@ -90,19 +90,17 @@ export class Ensure<Actual> extends Interaction {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* Creates an
|
|
94
|
-
* verifies if the resolved value of the provided
|
|
95
|
-
* meets the specified
|
|
93
|
+
* Creates an [interaction](https://serenity-js.org/api/core/class/Interaction/) to [`EnsureEventually`](https://serenity-js.org/api/assertions/class/EnsureEventually/),
|
|
94
|
+
* which verifies if the resolved value of the provided [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
95
|
+
* meets the specified [`Expectation`](https://serenity-js.org/api/core/class/Expectation/) within the expected timeframe.
|
|
96
96
|
*
|
|
97
|
-
* If the expectation is not met by the time the timeout expires, the interaction throws an
|
|
98
|
-
* `EnsureEventually` ignores retries the evaluation if resolving the `actual` results in an {@apilink OptionalNotPresentError},
|
|
99
|
-
* but rethrows any other errors.
|
|
97
|
+
* If the expectation is not met by the time the timeout expires, the interaction throws an [`AssertionError`](https://serenity-js.org/api/core/class/AssertionError/).
|
|
100
98
|
*
|
|
101
99
|
* @param {Answerable<Actual_Type>} actual
|
|
102
|
-
* An
|
|
100
|
+
* An [`Answerable`](https://serenity-js.org/api/core/#Answerable) describing the actual state of the system.
|
|
103
101
|
*
|
|
104
102
|
* @param {Expectation<Actual_Type>} expectation
|
|
105
|
-
* An
|
|
103
|
+
* An [`Expectation`](https://serenity-js.org/api/core/class/Expectation/) you expect the `actual` value to meet
|
|
106
104
|
*
|
|
107
105
|
* @returns {Ensure<Actual_Type>}
|
|
108
106
|
*/
|
|
@@ -150,11 +148,11 @@ export class Ensure<Actual> extends Interaction {
|
|
|
150
148
|
}
|
|
151
149
|
|
|
152
150
|
/**
|
|
153
|
-
* Overrides the default
|
|
151
|
+
* Overrides the default [`AssertionError`](https://serenity-js.org/api/core/class/AssertionError/) thrown when
|
|
154
152
|
* the actual value does not meet the expectation.
|
|
155
153
|
*
|
|
156
154
|
* @param typeOfRuntimeError
|
|
157
|
-
* A constructor function producing a subtype of
|
|
155
|
+
* A constructor function producing a subtype of [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/) to throw, e.g. [`TestCompromisedError`](https://serenity-js.org/api/core/class/TestCompromisedError/)
|
|
158
156
|
*
|
|
159
157
|
* @param message
|
|
160
158
|
* The message explaining the failure
|
package/src/EnsureEventually.ts
CHANGED
|
@@ -22,16 +22,16 @@ import {
|
|
|
22
22
|
import type { FileSystemLocation } from '@serenity-js/core/lib/io';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* The
|
|
26
|
-
* verifies if the resolved value of the provided
|
|
27
|
-
* meets the specified
|
|
25
|
+
* The [interaction](https://serenity-js.org/api/core/class/Interaction/) to `EnsureEventually`
|
|
26
|
+
* verifies if the resolved value of the provided [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
27
|
+
* meets the specified [`Expectation`](https://serenity-js.org/api/core/class/Expectation/) within the expected timeframe.
|
|
28
28
|
*
|
|
29
|
-
* If the expectation is not met by the time the timeout expires, the interaction throws an
|
|
30
|
-
* `EnsureEventually` retries the evaluation if resolving the `actual` results in an
|
|
29
|
+
* If the expectation is not met by the time the timeout expires, the interaction throws an [`AssertionError`](https://serenity-js.org/api/core/class/AssertionError/).
|
|
30
|
+
* `EnsureEventually` retries the evaluation if resolving the `actual` results in an [`ListItemNotFoundError`](https://serenity-js.org/api/core/class/ListItemNotFoundError/),
|
|
31
31
|
* but rethrows any other errors.
|
|
32
32
|
*
|
|
33
33
|
* :::tip Use the factory method
|
|
34
|
-
* Use the factory method
|
|
34
|
+
* Use the factory method [`Ensure.eventually`](https://serenity-js.org/api/assertions/class/Ensure/#eventually] to instantiate this interaction.
|
|
35
35
|
* :::
|
|
36
36
|
*
|
|
37
37
|
* ## Basic usage with dynamic values
|
|
@@ -99,7 +99,7 @@ export class EnsureEventually<Actual> extends Interaction {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* Override the default timeout set via
|
|
102
|
+
* Override the default timeout set via [`SerenityConfig.interactionTimeout`](https://serenity-js.org/api/core/class/SerenityConfig/#interactionTimeout).
|
|
103
103
|
*
|
|
104
104
|
* @param timeout
|
|
105
105
|
*/
|
|
@@ -149,11 +149,11 @@ export class EnsureEventually<Actual> extends Interaction {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
* Overrides the default
|
|
152
|
+
* Overrides the default [`AssertionError`](https://serenity-js.org/api/core/class/AssertionError/) thrown when
|
|
153
153
|
* the actual value does not meet the expectation.
|
|
154
154
|
*
|
|
155
155
|
* @param typeOfRuntimeError
|
|
156
|
-
* A constructor function producing a subtype of
|
|
156
|
+
* A constructor function producing a subtype of [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/) to throw, e.g. [`TestCompromisedError`](https://serenity-js.org/api/core/class/TestCompromisedError/)
|
|
157
157
|
*
|
|
158
158
|
* @param message
|
|
159
159
|
* The message explaining the failure
|
package/src/expectations/and.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Answerable, AnswersQuestions, ExpectationOutcome } from '@serenity
|
|
|
2
2
|
import { Expectation, ExpectationMet, ExpectationNotMet } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Creates an
|
|
5
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when all the `expectations` are met for the given actual value.
|
|
6
6
|
*
|
|
7
7
|
* Use `and` to combine several expectations using logical "and",
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@ import { Expectation } from '@serenity-js/core';
|
|
|
2
2
|
import { equal } from 'tiny-types/lib/objects';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Produces an
|
|
5
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual array of `Item[]` contains
|
|
6
6
|
* at least one `Item` that is equal to the resolved value of `expected`.
|
|
7
7
|
*
|
|
8
8
|
* Note that the equality check performs comparison **by value**
|
|
@@ -2,7 +2,7 @@ import type { Answerable, AnswersQuestions, ExpectationOutcome} from '@serenity-
|
|
|
2
2
|
import { d, Expectation, ExpectationDetails, ExpectationMet, ExpectationNotMet, Unanswered } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Produces an
|
|
5
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual array of `Item[]` contains
|
|
6
6
|
* at least one `Item` for which the `expectation` is met.
|
|
7
7
|
*
|
|
8
8
|
* ## Ensuring that at least one item in an array meets the expectation
|
|
@@ -2,7 +2,7 @@ import type { Answerable, AnswersQuestions, ExpectationOutcome} from '@serenity-
|
|
|
2
2
|
import { d, Expectation, ExpectationDetails, ExpectationMet, ExpectationNotMet, Unanswered } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Produces an
|
|
5
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when all the items of the actual array of `Item[]`
|
|
6
6
|
* meet the `expectation`.
|
|
7
7
|
*
|
|
8
8
|
* ## Ensuring that all the items in an array meet the expectation
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
5
5
|
* ends with the resolved value of `expected`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given string ends with an expected substring
|
|
@@ -2,7 +2,7 @@ import { Expectation } from '@serenity-js/core';
|
|
|
2
2
|
import { equal } from 'tiny-types/lib/objects';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Produces an
|
|
5
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value
|
|
6
6
|
* is equal to the resolved value of `expectedValue`.
|
|
7
7
|
*
|
|
8
8
|
* Note that the equality check performs comparison **by value**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
5
5
|
* includes a substring of `expected`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given string includes the expected substring
|
|
@@ -17,7 +17,7 @@ import { Expectation } from '@serenity-js/core';
|
|
|
17
17
|
*
|
|
18
18
|
* ## Ensuring that page URL includes the expected substring
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* [`Page.current().url()`](https://serenity-js.org/api/web/class/Page/#url) returns a [`QuestionAdapter<URL>`](https://serenity-js.org/api/core/#QuestionAdapter)
|
|
21
21
|
* a proxy object around the standard Node.js [URL](https://nodejs.org/api/url.html) class,
|
|
22
22
|
* offering access to `string` properties such as [`hostname`](https://nodejs.org/api/url.html#urlobjecthostname),
|
|
23
23
|
* [`pathname`](https://nodejs.org/api/url.html#urlobjectpathname), and so on.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation, type Timestamp } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `Date`
|
|
5
5
|
* is after the expected `Date`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given date is after the expected date
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation, type Timestamp } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `Date`
|
|
5
5
|
* is before the expected `Date`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given date is after the expected date
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d, Expectation } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Produces an
|
|
4
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value
|
|
5
5
|
* is within a given ± `absoluteTolerance` range of the `expected` value.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given floating point number is close to the expected number
|
|
@@ -3,7 +3,7 @@ import { Expectation } from '@serenity-js/core';
|
|
|
3
3
|
import { equals } from './equals';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Creates an
|
|
6
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
7
7
|
* is `false`.
|
|
8
8
|
*
|
|
9
9
|
* ## Ensuring that a given value is false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `number`
|
|
5
5
|
* is greater than the expected `number`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given number is greater than the expected number
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `number`
|
|
5
5
|
* is less than the expected `number`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given number is less than the expected number
|
|
@@ -2,10 +2,11 @@ import type { Answerable, AnswersQuestions, Optional } from '@serenity-js/core';
|
|
|
2
2
|
import { Expectation, ExpectationDetails, ExpectationMet, ExpectationNotMet } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Creates an
|
|
5
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the `actual` value is not undefined or null.
|
|
6
6
|
*
|
|
7
|
-
* Also, when the `actual` implements
|
|
8
|
-
*
|
|
7
|
+
* Also, when the `actual` implements [`Optional`](https://serenity-js.org/api/core/interface/Optional/),
|
|
8
|
+
* the expectation is met when calling [`Optional.isPresent`](https://serenity-js.org/api/core/interface/Optional/#isPresent)
|
|
9
|
+
* returns an [`Answerable`](https://serenity-js.org/api/core/#Answerable) that resolves to `true`
|
|
9
10
|
*
|
|
10
11
|
* ## Ensuring that a value is defined
|
|
11
12
|
*
|
|
@@ -3,7 +3,7 @@ import { Expectation } from '@serenity-js/core';
|
|
|
3
3
|
import { equals } from './equals';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Creates an
|
|
6
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
7
7
|
* is `true`.
|
|
8
8
|
*
|
|
9
9
|
* ## Ensuring that a given value is true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
5
5
|
* matches the `expected` regular expression.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given string matches a regular expression
|
package/src/expectations/not.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Answerable, AnswersQuestions} from '@serenity-js/core';
|
|
|
2
2
|
import { Expectation, ExpectationDetails, ExpectationMet, ExpectationNotMet } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Produces an
|
|
5
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that negates the provided `expectation`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that the actual value does not equal the expected value
|
|
8
8
|
*
|
package/src/expectations/or.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Answerable, AnswersQuestions, ExpectationOutcome} from '@serenity-
|
|
|
2
2
|
import { Expectation, ExpectationMet, ExpectationNotMet, LogicError } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Creates an
|
|
5
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when at least one of the `expectations` is met for the given actual value.
|
|
6
6
|
*
|
|
7
7
|
* Use `or` to combine several expectations using logical "or",
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@ import type { Answerable, AnswersQuestions} from '@serenity-js/core';
|
|
|
2
2
|
import { Expectation, ExpectationDetails, ExpectationMet, ExpectationNotMet } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Creates an
|
|
5
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the value of
|
|
6
6
|
* the `actual[propertyName]` meets the `expectation`.
|
|
7
7
|
*
|
|
8
8
|
* ## Ensuring that an array has an item
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates an
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
5
5
|
* starts with the resolved value of `expected`.
|
|
6
6
|
*
|
|
7
7
|
* ## Ensuring that a given string starts with an expected substring
|