@serenity-js/assertions 3.41.1 → 3.42.0
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 +20 -0
- package/esm/Ensure.d.ts +110 -0
- package/esm/Ensure.d.ts.map +1 -0
- package/esm/Ensure.js +148 -0
- package/esm/Ensure.js.map +1 -0
- package/esm/EnsureEventually.d.ts +98 -0
- package/esm/EnsureEventually.d.ts.map +1 -0
- package/esm/EnsureEventually.js +142 -0
- package/esm/EnsureEventually.js.map +1 -0
- package/esm/expectations/and.d.ts +23 -0
- package/esm/expectations/and.d.ts.map +1 -0
- package/esm/expectations/and.js +46 -0
- package/esm/expectations/and.js.map +1 -0
- package/esm/expectations/contain.d.ts +27 -0
- package/esm/expectations/contain.d.ts.map +1 -0
- package/esm/expectations/contain.js +28 -0
- package/esm/expectations/contain.js.map +1 -0
- package/esm/expectations/containAtLeastOneItemThat.d.ts +24 -0
- package/esm/expectations/containAtLeastOneItemThat.d.ts.map +1 -0
- package/esm/expectations/containAtLeastOneItemThat.js +53 -0
- package/esm/expectations/containAtLeastOneItemThat.js.map +1 -0
- package/esm/expectations/containItemsWhereEachItem.d.ts +24 -0
- package/esm/expectations/containItemsWhereEachItem.d.ts.map +1 -0
- package/esm/expectations/containItemsWhereEachItem.js +53 -0
- package/esm/expectations/containItemsWhereEachItem.js.map +1 -0
- package/esm/expectations/endsWith.d.ts +22 -0
- package/esm/expectations/endsWith.d.ts.map +1 -0
- package/esm/expectations/endsWith.js +22 -0
- package/esm/expectations/endsWith.js.map +1 -0
- package/esm/expectations/equals.d.ts +28 -0
- package/esm/expectations/equals.d.ts.map +1 -0
- package/esm/expectations/equals.js +29 -0
- package/esm/expectations/equals.js.map +1 -0
- package/esm/expectations/includes.d.ts +41 -0
- package/esm/expectations/includes.d.ts.map +1 -0
- package/esm/expectations/includes.js +41 -0
- package/esm/expectations/includes.js.map +1 -0
- package/esm/expectations/index.d.ts +21 -0
- package/esm/expectations/index.d.ts.map +1 -0
- package/esm/expectations/index.js +21 -0
- package/esm/expectations/index.js.map +1 -0
- package/esm/expectations/isAfter.d.ts +42 -0
- package/esm/expectations/isAfter.d.ts.map +1 -0
- package/esm/expectations/isAfter.js +50 -0
- package/esm/expectations/isAfter.js.map +1 -0
- package/esm/expectations/isBefore.d.ts +42 -0
- package/esm/expectations/isBefore.d.ts.map +1 -0
- package/esm/expectations/isBefore.js +50 -0
- package/esm/expectations/isBefore.js.map +1 -0
- package/esm/expectations/isCloseTo.d.ts +24 -0
- package/esm/expectations/isCloseTo.d.ts.map +1 -0
- package/esm/expectations/isCloseTo.js +34 -0
- package/esm/expectations/isCloseTo.js.map +1 -0
- package/esm/expectations/isFalse.d.ts +21 -0
- package/esm/expectations/isFalse.d.ts.map +1 -0
- package/esm/expectations/isFalse.js +24 -0
- package/esm/expectations/isFalse.js.map +1 -0
- package/esm/expectations/isGreaterThan.d.ts +45 -0
- package/esm/expectations/isGreaterThan.d.ts.map +1 -0
- package/esm/expectations/isGreaterThan.js +45 -0
- package/esm/expectations/isGreaterThan.js.map +1 -0
- package/esm/expectations/isLessThan.d.ts +45 -0
- package/esm/expectations/isLessThan.d.ts.map +1 -0
- package/esm/expectations/isLessThan.js +45 -0
- package/esm/expectations/isLessThan.js.map +1 -0
- package/esm/expectations/isPresent.d.ts +65 -0
- package/esm/expectations/isPresent.d.ts.map +1 -0
- package/esm/expectations/isPresent.js +96 -0
- package/esm/expectations/isPresent.js.map +1 -0
- package/esm/expectations/isTrue.d.ts +21 -0
- package/esm/expectations/isTrue.d.ts.map +1 -0
- package/esm/expectations/isTrue.js +24 -0
- package/esm/expectations/isTrue.js.map +1 -0
- package/esm/expectations/matches.d.ts +22 -0
- package/esm/expectations/matches.d.ts.map +1 -0
- package/esm/expectations/matches.js +22 -0
- package/esm/expectations/matches.js.map +1 -0
- package/esm/expectations/not.d.ts +24 -0
- package/esm/expectations/not.d.ts.map +1 -0
- package/esm/expectations/not.js +48 -0
- package/esm/expectations/not.js.map +1 -0
- package/esm/expectations/or.d.ts +23 -0
- package/esm/expectations/or.d.ts.map +1 -0
- package/esm/expectations/or.js +53 -0
- package/esm/expectations/or.js.map +1 -0
- package/esm/expectations/property.d.ts +62 -0
- package/esm/expectations/property.d.ts.map +1 -0
- package/esm/expectations/property.js +82 -0
- package/esm/expectations/property.js.map +1 -0
- package/esm/expectations/startsWith.d.ts +22 -0
- package/esm/expectations/startsWith.d.ts.map +1 -0
- package/esm/expectations/startsWith.js +22 -0
- package/esm/expectations/startsWith.js.map +1 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +4 -0
- package/esm/index.js.map +1 -0
- package/lib/Ensure.d.ts +1 -1
- package/lib/Ensure.d.ts.map +1 -1
- package/lib/Ensure.js +2 -2
- package/lib/Ensure.js.map +1 -1
- package/lib/EnsureEventually.d.ts +1 -1
- package/lib/EnsureEventually.d.ts.map +1 -1
- package/lib/expectations/contain.js +2 -2
- package/lib/expectations/contain.js.map +1 -1
- package/lib/expectations/equals.js +2 -2
- package/lib/expectations/equals.js.map +1 -1
- package/lib/expectations/index.d.ts +20 -20
- package/lib/expectations/index.d.ts.map +1 -1
- package/lib/expectations/index.js +20 -20
- package/lib/expectations/index.js.map +1 -1
- package/lib/expectations/isAfter.d.ts +1 -1
- package/lib/expectations/isBefore.d.ts +1 -1
- package/lib/expectations/isFalse.js +2 -2
- package/lib/expectations/isFalse.js.map +1 -1
- package/lib/expectations/isTrue.js +2 -2
- package/lib/expectations/isTrue.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -0
- package/package.json +31 -8
- package/src/Ensure.ts +2 -2
- package/src/EnsureEventually.ts +1 -1
- package/src/expectations/contain.ts +1 -1
- package/src/expectations/equals.ts +1 -1
- package/src/expectations/index.ts +20 -20
- package/src/expectations/isFalse.ts +1 -1
- package/src/expectations/isTrue.ts +1 -1
- package/src/index.ts +3 -3
- package/tsconfig-cjs.build.json +17 -0
- package/tsconfig-esm.build.json +18 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `Date`
|
|
4
|
+
* is before the expected `Date`.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given date is after the expected date
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isBefore } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Ester').attemptsTo(
|
|
13
|
+
* Ensure.that(new Date('1995-01-01'), isBefore(new Date('2022-01-01'))),
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Ensuring that a given date is within the expected date range
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { actorCalled, Expectation, d } from '@serenity-js/core'
|
|
21
|
+
* import { Ensure, and, isAfter, isBefore } from '@serenity-js/assertions'
|
|
22
|
+
*
|
|
23
|
+
* const isWithinDateRange = (lowerBound: Answerable<Date>, upperBound: Answerable<Date>) =>
|
|
24
|
+
* Expectation.to(d`have value that is between ${ lowerBound } and ${ upperBound }`)
|
|
25
|
+
* .soThatActual(
|
|
26
|
+
* and(isAfter(lowerBound), isBefore(upperBound))
|
|
27
|
+
* ),
|
|
28
|
+
*
|
|
29
|
+
* await actorCalled('Ester').attemptsTo(
|
|
30
|
+
* Ensure.that(
|
|
31
|
+
* new Date('2022-01-01'),
|
|
32
|
+
* isWithinDateRange(new Date('1995-01-01'), new Date('2025-01-01'))
|
|
33
|
+
* ),
|
|
34
|
+
* )
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param expected
|
|
38
|
+
*
|
|
39
|
+
* @group Expectations
|
|
40
|
+
*/
|
|
41
|
+
export const isBefore = Expectation.define('isBefore', 'have value that is before', (actual, expected) => {
|
|
42
|
+
const actualInMilliseconds = actual instanceof Date
|
|
43
|
+
? actual.getTime()
|
|
44
|
+
: actual.toMilliseconds();
|
|
45
|
+
const expectedInMilliseconds = expected instanceof Date
|
|
46
|
+
? expected.getTime()
|
|
47
|
+
: expected.toMilliseconds();
|
|
48
|
+
return actualInMilliseconds < expectedInMilliseconds;
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=isBefore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isBefore.js","sourceRoot":"","sources":["../../src/expectations/isBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CACtC,UAAU,EAAE,2BAA2B,EACvC,CAAC,MAAwB,EAAE,QAA0B,EAAE,EAAE;IAErD,MAAM,oBAAoB,GAAG,MAAM,YAAY,IAAI;QAC/C,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE;QAClB,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IAE9B,MAAM,sBAAsB,GAAG,QAAQ,YAAY,IAAI;QACnD,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE;QACpB,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;IAEhC,OAAO,oBAAoB,GAAG,sBAAsB,CAAC;AACzD,CAAC,CACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value
|
|
4
|
+
* is within a given ± `absoluteTolerance` range of the `expected` value.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given floating point number is close to the expected number
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isCloseTo } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Iris').attemptsTo(
|
|
13
|
+
* Ensure.that(10.123, isCloseTo(10, 0.2))
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param expected
|
|
18
|
+
* @param [absoluteTolerance=1e-9]
|
|
19
|
+
* Absolute ± tolerance range, defaults to `1e-9`
|
|
20
|
+
*
|
|
21
|
+
* @group Expectations
|
|
22
|
+
*/
|
|
23
|
+
export declare const isCloseTo: (expected: import("@serenity-js/core").Answerable<number>, absoluteTolerance?: import("@serenity-js/core").Answerable<number>) => Expectation<number>;
|
|
24
|
+
//# sourceMappingURL=isCloseTo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCloseTo.d.ts","sourceRoot":"","sources":["../../src/expectations/isCloseTo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS,uJAiBrB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { d, Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Produces an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value
|
|
4
|
+
* is within a given ± `absoluteTolerance` range of the `expected` value.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given floating point number is close to the expected number
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isCloseTo } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Iris').attemptsTo(
|
|
13
|
+
* Ensure.that(10.123, isCloseTo(10, 0.2))
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param expected
|
|
18
|
+
* @param [absoluteTolerance=1e-9]
|
|
19
|
+
* Absolute ± tolerance range, defaults to `1e-9`
|
|
20
|
+
*
|
|
21
|
+
* @group Expectations
|
|
22
|
+
*/
|
|
23
|
+
export const isCloseTo = Expectation.define('isCloseTo', (expected, absoluteTolerance = 1e-9) => d `have value close to ${expected} ±${absoluteTolerance}`, (actual, expected, absoluteTolerance = 1e-9) => {
|
|
24
|
+
// short-circuit exact equality
|
|
25
|
+
if (actual === expected) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (!(Number.isFinite(actual) && Number.isFinite(expected))) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const difference = Math.abs(actual - expected);
|
|
32
|
+
return difference <= absoluteTolerance;
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=isCloseTo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCloseTo.js","sourceRoot":"","sources":["../../src/expectations/isCloseTo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CACvC,WAAW,EAAE,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,CAAA,uBAAwB,QAAS,KAAM,iBAAkB,EAAE,EAEjH,CAAC,MAAc,EAAE,QAAgB,EAAE,oBAA4B,IAAI,EAAE,EAAE;IACnE,+BAA+B;IAC/B,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAA;IAE9C,OAAO,UAAU,IAAI,iBAAiB,CAAC;AAC3C,CAAC,CACJ,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
4
|
+
* is `false`.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given value is false
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isFalse } from '@serenity-js/assertions'
|
|
11
|
+
* import { Cookie } from '@serenity-js/web'
|
|
12
|
+
*
|
|
13
|
+
* await actorCalled('Ester').attemptsTo(
|
|
14
|
+
* Ensure.that(Cookie.called('example-regular-cookie').isSecure(), isFalse()),
|
|
15
|
+
* )
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @group Expectations
|
|
19
|
+
*/
|
|
20
|
+
export declare function isFalse(): Expectation<boolean>;
|
|
21
|
+
//# sourceMappingURL=isFalse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFalse.d.ts","sourceRoot":"","sources":["../../src/expectations/isFalse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAE9C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
import { equals } from './equals.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
5
|
+
* is `false`.
|
|
6
|
+
*
|
|
7
|
+
* ## Ensuring that a given value is false
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
11
|
+
* import { Ensure, isFalse } from '@serenity-js/assertions'
|
|
12
|
+
* import { Cookie } from '@serenity-js/web'
|
|
13
|
+
*
|
|
14
|
+
* await actorCalled('Ester').attemptsTo(
|
|
15
|
+
* Ensure.that(Cookie.called('example-regular-cookie').isSecure(), isFalse()),
|
|
16
|
+
* )
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @group Expectations
|
|
20
|
+
*/
|
|
21
|
+
export function isFalse() {
|
|
22
|
+
return Expectation.to(`equal false`).soThatActual(equals(false));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=isFalse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFalse.js","sourceRoot":"","sources":["../../src/expectations/isFalse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,OAAO;IACnB,OAAO,WAAW,CAAC,EAAE,CAAU,aAAa,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `number`
|
|
4
|
+
* is greater than the expected `number`.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given number is greater than the expected number
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isGreaterThan } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Ester').attemptsTo(
|
|
13
|
+
* Ensure.that(10, isGreaterThan(5)),
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Ensuring that a given number is within the expected range
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { actorCalled, Expectation, d } from '@serenity-js/core'
|
|
21
|
+
* import { Ensure, and, equals, isGreaterThan, isLessThan, or } from '@serenity-js/assertions'
|
|
22
|
+
*
|
|
23
|
+
* const isWithinRange = (lowerBound: Answerable<number>, upperBound: Answerable<number>) =>
|
|
24
|
+
* Expectation.to(d`have value that is between ${ lowerBound } and ${ upperBound }`)
|
|
25
|
+
* .soThatActual(
|
|
26
|
+
* and(
|
|
27
|
+
* or(equals(lowerBound), isGreaterThan(lowerBound)),
|
|
28
|
+
* or(equals(upperBound), isLessThan(upperBound)),
|
|
29
|
+
* )
|
|
30
|
+
* ),
|
|
31
|
+
*
|
|
32
|
+
* await actorCalled('Ester').attemptsTo(
|
|
33
|
+
* Ensure.that(
|
|
34
|
+
* 7,
|
|
35
|
+
* isWithinRange(5, 10)
|
|
36
|
+
* ),
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param expected
|
|
41
|
+
*
|
|
42
|
+
* @group Expectations
|
|
43
|
+
*/
|
|
44
|
+
export declare const isGreaterThan: (expected: import("@serenity-js/core").Answerable<number>) => Expectation<number>;
|
|
45
|
+
//# sourceMappingURL=isGreaterThan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isGreaterThan.d.ts","sourceRoot":"","sources":["../../src/expectations/isGreaterThan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,aAAa,mFAIzB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `number`
|
|
4
|
+
* is greater than the expected `number`.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given number is greater than the expected number
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isGreaterThan } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Ester').attemptsTo(
|
|
13
|
+
* Ensure.that(10, isGreaterThan(5)),
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Ensuring that a given number is within the expected range
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { actorCalled, Expectation, d } from '@serenity-js/core'
|
|
21
|
+
* import { Ensure, and, equals, isGreaterThan, isLessThan, or } from '@serenity-js/assertions'
|
|
22
|
+
*
|
|
23
|
+
* const isWithinRange = (lowerBound: Answerable<number>, upperBound: Answerable<number>) =>
|
|
24
|
+
* Expectation.to(d`have value that is between ${ lowerBound } and ${ upperBound }`)
|
|
25
|
+
* .soThatActual(
|
|
26
|
+
* and(
|
|
27
|
+
* or(equals(lowerBound), isGreaterThan(lowerBound)),
|
|
28
|
+
* or(equals(upperBound), isLessThan(upperBound)),
|
|
29
|
+
* )
|
|
30
|
+
* ),
|
|
31
|
+
*
|
|
32
|
+
* await actorCalled('Ester').attemptsTo(
|
|
33
|
+
* Ensure.that(
|
|
34
|
+
* 7,
|
|
35
|
+
* isWithinRange(5, 10)
|
|
36
|
+
* ),
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param expected
|
|
41
|
+
*
|
|
42
|
+
* @group Expectations
|
|
43
|
+
*/
|
|
44
|
+
export const isGreaterThan = Expectation.define('isGreaterThan', 'have value greater than', (actual, expected) => actual > expected);
|
|
45
|
+
//# sourceMappingURL=isGreaterThan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isGreaterThan.js","sourceRoot":"","sources":["../../src/expectations/isGreaterThan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAC3C,eAAe,EAAE,yBAAyB,EAC1C,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE,CACjC,MAAM,GAAG,QAAQ,CACxB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `number`
|
|
4
|
+
* is less than the expected `number`.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given number is less than the expected number
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isLessThan } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Ester').attemptsTo(
|
|
13
|
+
* Ensure.that(5, isLessThan(10)),
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Ensuring that a given number is within the expected range
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { actorCalled, Expectation, d } from '@serenity-js/core'
|
|
21
|
+
* import { Ensure, and, equals, isGreaterThan, isLessThan, or } from '@serenity-js/assertions'
|
|
22
|
+
*
|
|
23
|
+
* const isWithinRange = (lowerBound: Answerable<number>, upperBound: Answerable<number>) =>
|
|
24
|
+
* Expectation.to(d`have value that is between ${ lowerBound } and ${ upperBound }`)
|
|
25
|
+
* .soThatActual(
|
|
26
|
+
* and(
|
|
27
|
+
* or(equals(lowerBound), isGreaterThan(lowerBound)),
|
|
28
|
+
* or(equals(upperBound), isLessThan(upperBound)),
|
|
29
|
+
* )
|
|
30
|
+
* ),
|
|
31
|
+
*
|
|
32
|
+
* await actorCalled('Ester').attemptsTo(
|
|
33
|
+
* Ensure.that(
|
|
34
|
+
* 7,
|
|
35
|
+
* isWithinRange(5, 10)
|
|
36
|
+
* ),
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param expected
|
|
41
|
+
*
|
|
42
|
+
* @group Expectations
|
|
43
|
+
*/
|
|
44
|
+
export declare const isLessThan: (expected: import("@serenity-js/core").Answerable<number>) => Expectation<number>;
|
|
45
|
+
//# sourceMappingURL=isLessThan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isLessThan.d.ts","sourceRoot":"","sources":["../../src/expectations/isLessThan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,UAAU,mFAItB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual value of type `number`
|
|
4
|
+
* is less than the expected `number`.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given number is less than the expected number
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isLessThan } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Ester').attemptsTo(
|
|
13
|
+
* Ensure.that(5, isLessThan(10)),
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Ensuring that a given number is within the expected range
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { actorCalled, Expectation, d } from '@serenity-js/core'
|
|
21
|
+
* import { Ensure, and, equals, isGreaterThan, isLessThan, or } from '@serenity-js/assertions'
|
|
22
|
+
*
|
|
23
|
+
* const isWithinRange = (lowerBound: Answerable<number>, upperBound: Answerable<number>) =>
|
|
24
|
+
* Expectation.to(d`have value that is between ${ lowerBound } and ${ upperBound }`)
|
|
25
|
+
* .soThatActual(
|
|
26
|
+
* and(
|
|
27
|
+
* or(equals(lowerBound), isGreaterThan(lowerBound)),
|
|
28
|
+
* or(equals(upperBound), isLessThan(upperBound)),
|
|
29
|
+
* )
|
|
30
|
+
* ),
|
|
31
|
+
*
|
|
32
|
+
* await actorCalled('Ester').attemptsTo(
|
|
33
|
+
* Ensure.that(
|
|
34
|
+
* 7,
|
|
35
|
+
* isWithinRange(5, 10)
|
|
36
|
+
* ),
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param expected
|
|
41
|
+
*
|
|
42
|
+
* @group Expectations
|
|
43
|
+
*/
|
|
44
|
+
export const isLessThan = Expectation.define('isLessThan', `have value that's less than`, (actual, expected) => actual < expected);
|
|
45
|
+
//# sourceMappingURL=isLessThan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isLessThan.js","sourceRoot":"","sources":["../../src/expectations/isLessThan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CACxC,YAAY,EAAE,6BAA6B,EAC3C,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE,CACjC,MAAM,GAAG,QAAQ,CACxB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the `actual` value is not undefined or null.
|
|
4
|
+
*
|
|
5
|
+
* Also, when the `actual` implements [`Optional`](https://serenity-js.org/api/core/interface/Optional/),
|
|
6
|
+
* the expectation is met when calling [`Optional.isPresent`](https://serenity-js.org/api/core/interface/Optional/#isPresent)
|
|
7
|
+
* returns an [`Answerable`](https://serenity-js.org/api/core/#Answerable) that resolves to `true`
|
|
8
|
+
*
|
|
9
|
+
* ## Ensuring that a value is defined
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
13
|
+
* import { CallAnApi, Send, GetRequest, LastResponse } from '@serenity-js/rest'
|
|
14
|
+
* import { Ensure, isPresent } from '@serenity-js/assertions'
|
|
15
|
+
*
|
|
16
|
+
* interface Product {
|
|
17
|
+
* name: string;
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* interface ProductsResponse {
|
|
21
|
+
* products: Product[];
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* await actorCalled('Apisitt')
|
|
25
|
+
* .whoCan(CallAnApi.at('https://api.example.org'))
|
|
26
|
+
* .attemptsTo(
|
|
27
|
+
* Send.a(GetRequest.to('/products')),
|
|
28
|
+
* Ensure.that(LastResponse.body<ProductsResponse>().products[0], isPresent()),
|
|
29
|
+
* )
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* ## Checking if a PageElement is present
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { actorCalled, Check } from '@serenity-js/core';
|
|
36
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright';
|
|
37
|
+
* import { By, Click, Navigate, PageElement } from '@serenity-js/web';
|
|
38
|
+
* import { Browser, chromium } from 'playwright';
|
|
39
|
+
*
|
|
40
|
+
* class NewsletterSubscription {
|
|
41
|
+
* static modal = () =>
|
|
42
|
+
* PageElement.located(By.id('newsletter-subscription'))
|
|
43
|
+
* .describedAs('newsletter subscription modal')
|
|
44
|
+
*
|
|
45
|
+
* static closeButton = () =>
|
|
46
|
+
* PageElement.located(By.class('.close'))
|
|
47
|
+
* .of(NewsletterSubscription.modal())
|
|
48
|
+
* .describedAs('close button')
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* const browser = await chromium.launch({ headless: true });
|
|
52
|
+
*
|
|
53
|
+
* await actorCalled('Isabela')
|
|
54
|
+
* .whoCan(BrowseTheWebWithPlaywright.using(browser))
|
|
55
|
+
* .attemptsTo(
|
|
56
|
+
* Navigate.to(`https://example.org`),
|
|
57
|
+
* Check.whether(NewsletterSubscription.modal(), isPresent())
|
|
58
|
+
* .andIfSo(Click.on(NewsletterSubscription.closeButton())),
|
|
59
|
+
* )
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @group Expectations
|
|
63
|
+
*/
|
|
64
|
+
export declare function isPresent<Actual>(): Expectation<Actual>;
|
|
65
|
+
//# sourceMappingURL=isPresent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPresent.d.ts","sourceRoot":"","sources":["../../src/expectations/isPresent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyD,MAAM,mBAAmB,CAAC;AAEvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAgB,SAAS,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAEvD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Expectation, ExpectationDetails, ExpectationMet, ExpectationNotMet } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the `actual` value is not undefined or null.
|
|
4
|
+
*
|
|
5
|
+
* Also, when the `actual` implements [`Optional`](https://serenity-js.org/api/core/interface/Optional/),
|
|
6
|
+
* the expectation is met when calling [`Optional.isPresent`](https://serenity-js.org/api/core/interface/Optional/#isPresent)
|
|
7
|
+
* returns an [`Answerable`](https://serenity-js.org/api/core/#Answerable) that resolves to `true`
|
|
8
|
+
*
|
|
9
|
+
* ## Ensuring that a value is defined
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
13
|
+
* import { CallAnApi, Send, GetRequest, LastResponse } from '@serenity-js/rest'
|
|
14
|
+
* import { Ensure, isPresent } from '@serenity-js/assertions'
|
|
15
|
+
*
|
|
16
|
+
* interface Product {
|
|
17
|
+
* name: string;
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* interface ProductsResponse {
|
|
21
|
+
* products: Product[];
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* await actorCalled('Apisitt')
|
|
25
|
+
* .whoCan(CallAnApi.at('https://api.example.org'))
|
|
26
|
+
* .attemptsTo(
|
|
27
|
+
* Send.a(GetRequest.to('/products')),
|
|
28
|
+
* Ensure.that(LastResponse.body<ProductsResponse>().products[0], isPresent()),
|
|
29
|
+
* )
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* ## Checking if a PageElement is present
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { actorCalled, Check } from '@serenity-js/core';
|
|
36
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright';
|
|
37
|
+
* import { By, Click, Navigate, PageElement } from '@serenity-js/web';
|
|
38
|
+
* import { Browser, chromium } from 'playwright';
|
|
39
|
+
*
|
|
40
|
+
* class NewsletterSubscription {
|
|
41
|
+
* static modal = () =>
|
|
42
|
+
* PageElement.located(By.id('newsletter-subscription'))
|
|
43
|
+
* .describedAs('newsletter subscription modal')
|
|
44
|
+
*
|
|
45
|
+
* static closeButton = () =>
|
|
46
|
+
* PageElement.located(By.class('.close'))
|
|
47
|
+
* .of(NewsletterSubscription.modal())
|
|
48
|
+
* .describedAs('close button')
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* const browser = await chromium.launch({ headless: true });
|
|
52
|
+
*
|
|
53
|
+
* await actorCalled('Isabela')
|
|
54
|
+
* .whoCan(BrowseTheWebWithPlaywright.using(browser))
|
|
55
|
+
* .attemptsTo(
|
|
56
|
+
* Navigate.to(`https://example.org`),
|
|
57
|
+
* Check.whether(NewsletterSubscription.modal(), isPresent())
|
|
58
|
+
* .andIfSo(Click.on(NewsletterSubscription.closeButton())),
|
|
59
|
+
* )
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @group Expectations
|
|
63
|
+
*/
|
|
64
|
+
export function isPresent() {
|
|
65
|
+
return new IsPresent();
|
|
66
|
+
}
|
|
67
|
+
class IsPresent extends Expectation {
|
|
68
|
+
static isOptional(value) {
|
|
69
|
+
return value !== undefined
|
|
70
|
+
&& value !== null
|
|
71
|
+
&& typeof value.isPresent === 'function';
|
|
72
|
+
}
|
|
73
|
+
static valueToCheck(actual, actor) {
|
|
74
|
+
if (IsPresent.isOptional(actual)) {
|
|
75
|
+
return actual;
|
|
76
|
+
}
|
|
77
|
+
return actor.answer(actual);
|
|
78
|
+
}
|
|
79
|
+
static async isPresent(value, actor) {
|
|
80
|
+
if (IsPresent.isOptional(value)) {
|
|
81
|
+
return actor.answer(value.isPresent());
|
|
82
|
+
}
|
|
83
|
+
return value !== undefined
|
|
84
|
+
&& value !== null;
|
|
85
|
+
}
|
|
86
|
+
constructor() {
|
|
87
|
+
super('isPresent', 'become present', async (actor, actual) => {
|
|
88
|
+
const value = await IsPresent.valueToCheck(actual, actor);
|
|
89
|
+
const result = await IsPresent.isPresent(value, actor);
|
|
90
|
+
return result
|
|
91
|
+
? new ExpectationMet('become present', ExpectationDetails.of('isPresent'), true, actual)
|
|
92
|
+
: new ExpectationNotMet('become present', ExpectationDetails.of('isPresent'), true, actual);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=isPresent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/expectations/isPresent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,UAAU,SAAS;IACrB,OAAO,IAAI,SAAS,EAAU,CAAC;AACnC,CAAC;AAED,MAAM,SAAkB,SAAQ,WAAmB;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,CAAC;YAC/B,OAAO,MAAM,CAAC;QAClB,CAAC;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,CAAC;YAC9B,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QAC3C,CAAC;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,cAAc,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC;gBACxF,CAAC,CAAC,IAAI,iBAAiB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACpG,CAAC,CACJ,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
4
|
+
* is `true`.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given value is true
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, isTrue } from '@serenity-js/assertions'
|
|
11
|
+
* import { Cookie } from '@serenity-js/web'
|
|
12
|
+
*
|
|
13
|
+
* await actorCalled('Ester').attemptsTo(
|
|
14
|
+
* Ensure.that(Cookie.called('example-secure-cookie').isSecure(), isTrue()),
|
|
15
|
+
* )
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @group Expectations
|
|
19
|
+
*/
|
|
20
|
+
export declare function isTrue(): Expectation<boolean>;
|
|
21
|
+
//# sourceMappingURL=isTrue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTrue.d.ts","sourceRoot":"","sources":["../../src/expectations/isTrue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,CAE7C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
import { equals } from './equals.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `boolean` value
|
|
5
|
+
* is `true`.
|
|
6
|
+
*
|
|
7
|
+
* ## Ensuring that a given value is true
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
11
|
+
* import { Ensure, isTrue } from '@serenity-js/assertions'
|
|
12
|
+
* import { Cookie } from '@serenity-js/web'
|
|
13
|
+
*
|
|
14
|
+
* await actorCalled('Ester').attemptsTo(
|
|
15
|
+
* Ensure.that(Cookie.called('example-secure-cookie').isSecure(), isTrue()),
|
|
16
|
+
* )
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @group Expectations
|
|
20
|
+
*/
|
|
21
|
+
export function isTrue() {
|
|
22
|
+
return Expectation.to(`equal true`).soThatActual(equals(true));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=isTrue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTrue.js","sourceRoot":"","sources":["../../src/expectations/isTrue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,MAAM;IAClB,OAAO,WAAW,CAAC,EAAE,CAAU,YAAY,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
4
|
+
* matches the `expected` regular expression.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given string matches a regular expression
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, includes } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Ester').attemptsTo(
|
|
13
|
+
* Ensure.that('Hello World!', matches(/[Ww]orld/)),
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param expected
|
|
18
|
+
*
|
|
19
|
+
* @group Expectations
|
|
20
|
+
*/
|
|
21
|
+
export declare const matches: (expected: import("@serenity-js/core").Answerable<RegExp>) => Expectation<string>;
|
|
22
|
+
//# sourceMappingURL=matches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.d.ts","sourceRoot":"","sources":["../../src/expectations/matches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO,mFAInB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value
|
|
4
|
+
* matches the `expected` regular expression.
|
|
5
|
+
*
|
|
6
|
+
* ## Ensuring that a given string matches a regular expression
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
10
|
+
* import { Ensure, includes } from '@serenity-js/assertions'
|
|
11
|
+
*
|
|
12
|
+
* await actorCalled('Ester').attemptsTo(
|
|
13
|
+
* Ensure.that('Hello World!', matches(/[Ww]orld/)),
|
|
14
|
+
* )
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param expected
|
|
18
|
+
*
|
|
19
|
+
* @group Expectations
|
|
20
|
+
*/
|
|
21
|
+
export const matches = Expectation.define('matches', 'match', (actual, expected) => expected.test(actual));
|
|
22
|
+
//# sourceMappingURL=matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.js","sourceRoot":"","sources":["../../src/expectations/matches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CACrC,SAAS,EAAE,OAAO,EAClB,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE,CACjC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAC5B,CAAC"}
|