@serenity-js/assertions 3.0.0-rc.40 → 3.0.0-rc.42
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 +30 -0
- package/README.md +4 -4
- package/lib/Ensure.d.ts +2 -14
- package/lib/Ensure.d.ts.map +1 -1
- package/lib/Ensure.js +25 -51
- package/lib/Ensure.js.map +1 -1
- package/lib/expectations/and.d.ts.map +1 -1
- package/lib/expectations/and.js +10 -5
- package/lib/expectations/and.js.map +1 -1
- package/lib/expectations/contain.d.ts +2 -2
- package/lib/expectations/contain.d.ts.map +1 -1
- package/lib/expectations/contain.js +1 -5
- package/lib/expectations/contain.js.map +1 -1
- package/lib/expectations/containAtLeastOneItemThat.d.ts.map +1 -1
- package/lib/expectations/containAtLeastOneItemThat.js +5 -4
- package/lib/expectations/containAtLeastOneItemThat.js.map +1 -1
- package/lib/expectations/containItemsWhereEachItem.d.ts.map +1 -1
- package/lib/expectations/containItemsWhereEachItem.js +5 -4
- package/lib/expectations/containItemsWhereEachItem.js.map +1 -1
- package/lib/expectations/endsWith.d.ts +2 -2
- package/lib/expectations/endsWith.d.ts.map +1 -1
- package/lib/expectations/endsWith.js +1 -5
- package/lib/expectations/endsWith.js.map +1 -1
- package/lib/expectations/equals.d.ts +2 -2
- package/lib/expectations/equals.d.ts.map +1 -1
- package/lib/expectations/equals.js +1 -5
- package/lib/expectations/equals.js.map +1 -1
- package/lib/expectations/includes.d.ts +2 -2
- package/lib/expectations/includes.d.ts.map +1 -1
- package/lib/expectations/includes.js +1 -5
- package/lib/expectations/includes.js.map +1 -1
- package/lib/expectations/isAfter.d.ts +2 -2
- package/lib/expectations/isAfter.d.ts.map +1 -1
- package/lib/expectations/isAfter.js +1 -5
- package/lib/expectations/isAfter.js.map +1 -1
- package/lib/expectations/isBefore.d.ts +2 -2
- package/lib/expectations/isBefore.d.ts.map +1 -1
- package/lib/expectations/isBefore.js +1 -5
- package/lib/expectations/isBefore.js.map +1 -1
- package/lib/expectations/isCloseTo.d.ts +2 -2
- package/lib/expectations/isCloseTo.d.ts.map +1 -1
- package/lib/expectations/isCloseTo.js +10 -30
- package/lib/expectations/isCloseTo.js.map +1 -1
- package/lib/expectations/isFalse.js.map +1 -1
- package/lib/expectations/isGreaterThan.d.ts +2 -2
- package/lib/expectations/isGreaterThan.d.ts.map +1 -1
- package/lib/expectations/isGreaterThan.js +1 -5
- package/lib/expectations/isGreaterThan.js.map +1 -1
- package/lib/expectations/isLessThan.d.ts +2 -2
- package/lib/expectations/isLessThan.d.ts.map +1 -1
- package/lib/expectations/isLessThan.js +1 -5
- package/lib/expectations/isLessThan.js.map +1 -1
- package/lib/expectations/isPresent.d.ts.map +1 -1
- package/lib/expectations/isPresent.js +3 -3
- package/lib/expectations/isPresent.js.map +1 -1
- package/lib/expectations/isTrue.js.map +1 -1
- package/lib/expectations/matches.d.ts +2 -2
- package/lib/expectations/matches.d.ts.map +1 -1
- package/lib/expectations/matches.js +1 -5
- package/lib/expectations/matches.js.map +1 -1
- package/lib/expectations/not.d.ts.map +1 -1
- package/lib/expectations/not.js +4 -3
- package/lib/expectations/not.js.map +1 -1
- package/lib/expectations/or.js +3 -3
- package/lib/expectations/or.js.map +1 -1
- package/lib/expectations/property.d.ts.map +1 -1
- package/lib/expectations/property.js +4 -3
- package/lib/expectations/property.js.map +1 -1
- package/lib/expectations/startsWith.d.ts +2 -2
- package/lib/expectations/startsWith.d.ts.map +1 -1
- package/lib/expectations/startsWith.js +1 -5
- package/lib/expectations/startsWith.js.map +1 -1
- package/package.json +4 -4
- package/src/Ensure.ts +27 -65
- package/src/expectations/and.ts +17 -13
- package/src/expectations/contain.ts +6 -5
- package/src/expectations/containAtLeastOneItemThat.ts +14 -5
- package/src/expectations/containItemsWhereEachItem.ts +14 -5
- package/src/expectations/endsWith.ts +6 -5
- package/src/expectations/equals.ts +6 -5
- package/src/expectations/includes.ts +6 -5
- package/src/expectations/isAfter.ts +6 -5
- package/src/expectations/isBefore.ts +6 -5
- package/src/expectations/isCloseTo.ts +14 -40
- package/src/expectations/isFalse.ts +1 -1
- package/src/expectations/isGreaterThan.ts +6 -5
- package/src/expectations/isLessThan.ts +6 -5
- package/src/expectations/isPresent.ts +5 -5
- package/src/expectations/isTrue.ts +1 -1
- package/src/expectations/matches.ts +6 -5
- package/src/expectations/not.ts +5 -3
- package/src/expectations/or.ts +6 -4
- package/src/expectations/property.ts +8 -5
- package/src/expectations/startsWith.ts +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.0.0-rc.42](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.41...v3.0.0-rc.42) (2023-02-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.0.0-rc.41](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.40...v3.0.0-rc.41) (2023-02-07)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **assertions:** custom errors thrown via Ensure now include activity location ([1fdf7a2](https://github.com/serenity-js/serenity-js/commit/1fdf7a29aa4065d9ad23a750aa7c3cde6e36e2f1)), closes [#1102](https://github.com/serenity-js/serenity-js/issues/1102)
|
|
20
|
+
* **assertions:** interaction to Ensure no longer emits an AssertionReport artifact ([db3e5ae](https://github.com/serenity-js/serenity-js/commit/db3e5ae642f63ce808f52571f5ad840c614ef624)), closes [#1486](https://github.com/serenity-js/serenity-js/issues/1486)
|
|
21
|
+
* **core:** further improvements to how the expected vs received values are rendered in VS Code ([e2101d0](https://github.com/serenity-js/serenity-js/commit/e2101d0b11e56b1701bf75efe0d4f85ab72a6f48)), closes [#1486](https://github.com/serenity-js/serenity-js/issues/1486)
|
|
22
|
+
* **core:** introduced ExpectationDetails to provide more accurate info re failed expectations ([02b8f33](https://github.com/serenity-js/serenity-js/commit/02b8f33732341a9391192fc52a59ea8a8f5f19f0)), closes [#1102](https://github.com/serenity-js/serenity-js/issues/1102)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **core:** assertion and synchronisation errors include location of the activity that threw them ([f06f378](https://github.com/serenity-js/serenity-js/commit/f06f378b9427d81a5adcea219ef01cf616a48c20)), closes [#1102](https://github.com/serenity-js/serenity-js/issues/1102)
|
|
28
|
+
* **core:** assertion errors include precise information about unmet expectations and improved diffs ([1eb09b1](https://github.com/serenity-js/serenity-js/commit/1eb09b1c1c8fb059b53bd7fcefab660581abc7bc)), closes [#1102](https://github.com/serenity-js/serenity-js/issues/1102)
|
|
29
|
+
* **core:** better assertion errors reporting in Visual Studio Code ([3b94b7d](https://github.com/serenity-js/serenity-js/commit/3b94b7d606fae49e7ca77c2fbe09d07eeb042ea9)), closes [#1486](https://github.com/serenity-js/serenity-js/issues/1486)
|
|
30
|
+
* **core:** new ability to RaiseErrors ([4617d39](https://github.com/serenity-js/serenity-js/commit/4617d39a7b0d72381834abe27ff4393cbc79d0f5)), closes [#1102](https://github.com/serenity-js/serenity-js/issues/1102)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
# [3.0.0-rc.40](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.39...v3.0.0-rc.40) (2023-01-06)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @serenity-js/assertions
|
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ import { actorCalled } from '@serenity-js/core';
|
|
|
48
48
|
import { Check } from '@serenity-js/assertions';
|
|
49
49
|
import { Click, isVisible } from '@serenity-js/protractor';
|
|
50
50
|
|
|
51
|
-
actorCalled('Erica').attemptsTo(
|
|
51
|
+
await actorCalled('Erica').attemptsTo(
|
|
52
52
|
Check.whether(NewsletterModal, isVisible())
|
|
53
53
|
.andIfSo(Click.on(CloseModalButton)),
|
|
54
54
|
);
|
|
@@ -60,7 +60,7 @@ actorCalled('Erica').attemptsTo(
|
|
|
60
60
|
import { actorCalled } from '@serenity-js/core';
|
|
61
61
|
import { Click, isVisible, Wait } from '@serenity-js/protractor';
|
|
62
62
|
|
|
63
|
-
actorCalled('Erica').attemptsTo(
|
|
63
|
+
await actorCalled('Erica').attemptsTo(
|
|
64
64
|
Wait.until(CloseModalButton, isVisible()),
|
|
65
65
|
Click.on(CloseModalButton)
|
|
66
66
|
);
|
|
@@ -77,7 +77,7 @@ function isDivisibleBy(expected: Answerable<number>): Expectation<number> {
|
|
|
77
77
|
.soThat((actualValue, expectedValue) => actualValue % expectedValue === 0);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
actorCalled('Erica').attemptsTo(
|
|
80
|
+
await actorCalled('Erica').attemptsTo(
|
|
81
81
|
Ensure.that(4, isDivisibleBy(2)),
|
|
82
82
|
);
|
|
83
83
|
```
|
|
@@ -97,7 +97,7 @@ function isWithin(lowerBound: number, upperBound: number) {
|
|
|
97
97
|
));
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
actorCalled('Erica').attemptsTo(
|
|
100
|
+
await actorCalled('Erica').attemptsTo(
|
|
101
101
|
Ensure.that(5, isWithin(3, 6)),
|
|
102
102
|
);
|
|
103
103
|
```
|
package/lib/Ensure.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions,
|
|
2
|
-
import { FileSystemLocation } from '@serenity-js/core/lib/io';
|
|
1
|
+
import { Answerable, AnswersQuestions, CollectsArtifacts, Expectation, Interaction, RuntimeError, UsesAbilities } from '@serenity-js/core';
|
|
3
2
|
/**
|
|
4
3
|
* The {@apilink Interaction|interaction} to `Ensure`
|
|
5
4
|
* verifies if the resolved value of the provided {@apilink Answerable}
|
|
@@ -65,7 +64,7 @@ export declare class Ensure<Actual> extends Interaction {
|
|
|
65
64
|
* @param expectation
|
|
66
65
|
* @param location
|
|
67
66
|
*/
|
|
68
|
-
|
|
67
|
+
private constructor();
|
|
69
68
|
/**
|
|
70
69
|
* @inheritDoc
|
|
71
70
|
*/
|
|
@@ -81,16 +80,5 @@ export declare class Ensure<Actual> extends Interaction {
|
|
|
81
80
|
* The message explaining the failure
|
|
82
81
|
*/
|
|
83
82
|
otherwiseFailWith(typeOfRuntimeError: new (message: string, cause?: Error) => RuntimeError, message?: string): Interaction;
|
|
84
|
-
/**
|
|
85
|
-
* Maps an {@apilink ExpectationOutcome} to appropriate {@apilink RuntimeError}.
|
|
86
|
-
*/
|
|
87
|
-
protected errorForOutcome(outcome: ExpectationOutcome<any, Actual>): RuntimeError;
|
|
88
|
-
/**
|
|
89
|
-
* Maps an {@apilink Outcome} to {@apilink AssertionError}.
|
|
90
|
-
*
|
|
91
|
-
* @param outcome
|
|
92
|
-
*/
|
|
93
|
-
protected asAssertionError(outcome: ExpectationOutcome<any, Actual>): AssertionError;
|
|
94
|
-
private artifactFrom;
|
|
95
83
|
}
|
|
96
84
|
//# sourceMappingURL=Ensure.d.ts.map
|
package/lib/Ensure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ensure.d.ts","sourceRoot":"","sources":["../src/Ensure.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,UAAU,EACV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Ensure.d.ts","sourceRoot":"","sources":["../src/Ensure.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,UAAU,EACV,gBAAgB,EAEhB,iBAAiB,EAEjB,WAAW,EAIX,WAAW,EAGX,YAAY,EACZ,aAAa,EAChB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAa,MAAM,CAAC,MAAM,CAAE,SAAQ,WAAW;IAqBvC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC;IApBvD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC;IAIrH;;;;OAIG;IACH,OAAO;IAQP;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB3F;;;;;;;;;OASG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW;CAgB7H"}
|
package/lib/Ensure.js
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Ensure = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const inspected_1 = require("@serenity-js/core/lib/io/inspected");
|
|
6
|
-
const model_1 = require("@serenity-js/core/lib/model");
|
|
7
|
-
const tiny_types_1 = require("tiny-types");
|
|
8
5
|
/**
|
|
9
6
|
* The {@apilink Interaction|interaction} to `Ensure`
|
|
10
7
|
* verifies if the resolved value of the provided {@apilink Answerable}
|
|
@@ -80,15 +77,19 @@ class Ensure extends core_1.Interaction {
|
|
|
80
77
|
*/
|
|
81
78
|
async performAs(actor) {
|
|
82
79
|
const outcome = await actor.answer(this.expectation.isMetFor(this.actual));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
throw
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
if (outcome instanceof core_1.ExpectationNotMet) {
|
|
81
|
+
const actualDescription = (0, core_1.d) `${this.actual}`;
|
|
82
|
+
const message = `Expected ${actualDescription} to ${outcome.message}`;
|
|
83
|
+
throw core_1.RaiseErrors.as(actor).create(core_1.AssertionError, {
|
|
84
|
+
message,
|
|
85
|
+
expectation: outcome.expectation,
|
|
86
|
+
diff: { expected: outcome.expected, actual: outcome.actual },
|
|
87
|
+
location: this.instantiationLocation(),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (!(outcome instanceof core_1.ExpectationMet)) {
|
|
91
|
+
throw new core_1.LogicError((0, core_1.f) `Expectation#isMetFor(actual) should return an instance of an ExpectationOutcome, not ${outcome}`);
|
|
92
|
+
}
|
|
92
93
|
}
|
|
93
94
|
/**
|
|
94
95
|
* Overrides the default {@apilink AssertionError} thrown when
|
|
@@ -101,47 +102,20 @@ class Ensure extends core_1.Interaction {
|
|
|
101
102
|
* The message explaining the failure
|
|
102
103
|
*/
|
|
103
104
|
otherwiseFailWith(typeOfRuntimeError, message) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
*/
|
|
117
|
-
asAssertionError(outcome) {
|
|
118
|
-
const actualDescription = (0, core_1.d) `${this.actual}`;
|
|
119
|
-
const inspectedActual = (0, inspected_1.inspected)(outcome.actual, { inline: true, markQuestions: false });
|
|
120
|
-
const message = actualDescription === inspectedActual
|
|
121
|
-
? `Expected ${actualDescription} to ${outcome.message}`
|
|
122
|
-
: `Expected ${actualDescription} to ${outcome.message} but got ${inspectedActual}`;
|
|
123
|
-
return new core_1.AssertionError(message, outcome.expected, outcome.actual);
|
|
124
|
-
}
|
|
125
|
-
artifactFrom(expected, actual) {
|
|
126
|
-
return model_1.AssertionReport.fromJSON({
|
|
127
|
-
expected: (0, inspected_1.inspected)(expected),
|
|
128
|
-
actual: (0, inspected_1.inspected)(actual),
|
|
105
|
+
const location = this.instantiationLocation();
|
|
106
|
+
return core_1.Interaction.where(this.toString(), async (actor) => {
|
|
107
|
+
try {
|
|
108
|
+
await this.performAs(actor);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw core_1.RaiseErrors.as(actor).create(typeOfRuntimeError, {
|
|
112
|
+
message: message !== null && message !== void 0 ? message : error.message,
|
|
113
|
+
location,
|
|
114
|
+
cause: error
|
|
115
|
+
});
|
|
116
|
+
}
|
|
129
117
|
});
|
|
130
118
|
}
|
|
131
119
|
}
|
|
132
120
|
exports.Ensure = Ensure;
|
|
133
|
-
/**
|
|
134
|
-
* @package
|
|
135
|
-
*/
|
|
136
|
-
class EnsureOrFailWithCustomError extends Ensure {
|
|
137
|
-
constructor(actual, expectation, typeOfRuntimeError, message) {
|
|
138
|
-
super(actual, expectation, core_1.Activity.callerLocation(6));
|
|
139
|
-
this.typeOfRuntimeError = typeOfRuntimeError;
|
|
140
|
-
this.message = message;
|
|
141
|
-
}
|
|
142
|
-
errorForOutcome(outcome) {
|
|
143
|
-
const assertionError = this.asAssertionError(outcome);
|
|
144
|
-
return new this.typeOfRuntimeError(this.message || assertionError.message, assertionError);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
121
|
//# sourceMappingURL=Ensure.js.map
|
package/lib/Ensure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ensure.js","sourceRoot":"","sources":["../src/Ensure.ts"],"names":[],"mappings":";;;AAAA,4CAgB2B;
|
|
1
|
+
{"version":3,"file":"Ensure.js","sourceRoot":"","sources":["../src/Ensure.ts"],"names":[],"mappings":";;;AAAA,4CAgB2B;AAG3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAa,MAAe,SAAQ,kBAAW;IAE3C;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,CAAc,MAA+B,EAAE,WAAqC;QAC3F,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,eAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,YACuB,MAA0B,EAC1B,WAAgC,EACnD,QAA4B;QAE5B,KAAK,CAAC,IAAA,QAAC,EAAA,uBAAwB,MAAO,SAAU,WAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;QAJvD,WAAM,GAAN,MAAM,CAAoB;QAC1B,gBAAW,GAAX,WAAW,CAAqB;IAIvD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAA2D;QACvE,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAE3E,IAAI,OAAO,YAAY,wBAAiB,EAAE;YACtC,MAAM,iBAAiB,GAAG,IAAA,QAAC,EAAA,GAAI,IAAI,CAAC,MAAO,EAAE,CAAC;YAC9C,MAAM,OAAO,GAAG,YAAa,iBAAkB,OAAQ,OAAO,CAAC,OAAQ,EAAE,CAAC;YAE1E,MAAM,kBAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,qBAAc,EAAE;gBAC/C,OAAO;gBACP,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;gBAC5D,QAAQ,EAAE,IAAI,CAAC,qBAAqB,EAAE;aACzC,CAAC,CAAC;SACN;QAED,IAAI,CAAE,CAAC,OAAO,YAAY,qBAAc,CAAC,EAAE;YACvC,MAAM,IAAI,iBAAU,CAAC,IAAA,QAAC,EAAA,wFAAyF,OAAQ,EAAE,CAAC,CAAC;SAC9H;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,iBAAiB,CAAC,kBAAwE,EAAE,OAAgB;QACxG,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE9C,OAAO,kBAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACpD,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;aAC/B;YACD,OAAO,KAAK,EAAE;gBACV,MAAM,kBAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,kBAAkB,EAAE;oBACnD,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,KAAK,CAAC,OAAO;oBACjC,QAAQ;oBACR,KAAK,EAAE,KAAK;iBACf,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA7ED,wBA6EC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"and.d.ts","sourceRoot":"","sources":["../../src/expectations/and.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,WAAW,
|
|
1
|
+
{"version":3,"file":"and.d.ts","sourceRoot":"","sources":["../../src/expectations/and.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,WAAW,EAAyD,MAAM,mBAAmB,CAAC;AAErI;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,GAAG,CAAC,WAAW,EAAE,GAAG,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,WAAW,CAAC,CAE3G"}
|
package/lib/expectations/and.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.and = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const tiny_types_1 = require("tiny-types");
|
|
6
5
|
/**
|
|
7
6
|
* Creates an {@apilink Expectation|expectation} that is met when all the `expectations` are met for the given actual value.
|
|
8
7
|
*
|
|
@@ -32,10 +31,16 @@ exports.and = and;
|
|
|
32
31
|
*/
|
|
33
32
|
class And extends core_1.Expectation {
|
|
34
33
|
constructor(expectations) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const description = expectations.map(expectation => expectation.toString()).join(And.Separator);
|
|
35
|
+
super('and', description, async (actor, actual) => {
|
|
36
|
+
let outcome;
|
|
37
|
+
for (const expectation of expectations) {
|
|
38
|
+
outcome = await actor.answer(expectation.isMetFor(actual));
|
|
39
|
+
if (outcome instanceof core_1.ExpectationNotMet) {
|
|
40
|
+
return new core_1.ExpectationNotMet(description, outcome.expectation, outcome.expected, outcome.actual);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return new core_1.ExpectationMet(description, outcome === null || outcome === void 0 ? void 0 : outcome.expectation, outcome === null || outcome === void 0 ? void 0 : outcome.expected, outcome === null || outcome === void 0 ? void 0 : outcome.actual);
|
|
39
44
|
});
|
|
40
45
|
this.expectations = expectations;
|
|
41
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"and.js","sourceRoot":"","sources":["../../src/expectations/and.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"and.js","sourceRoot":"","sources":["../../src/expectations/and.ts"],"names":[],"mappings":";;;AAAA,4CAAqI;AAErI;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,GAAG,CAAc,GAAG,YAA6C;IAC7E,OAAO,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;AACjC,CAAC;AAFD,kBAEC;AAED;;GAEG;AACH,MAAM,GAAY,SAAQ,kBAAmB;IAGzC,YAA6B,YAAwC;QACjE,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEhG,KAAK,CACD,KAAK,EACL,WAAW,EACX,KAAK,EAAE,KAAuB,EAAE,MAA0B,EAAE,EAAE;YAC1D,IAAI,OAA2B,CAAC;YAEhC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;gBACpC,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;gBAE1D,IAAI,OAAO,YAAY,wBAAiB,EAAE;oBACtC,OAAO,IAAI,wBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;iBACpG;aACJ;YAED,OAAO,IAAI,qBAAc,CAAC,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,CAAC;QACrG,CAAC,CACJ,CAAC;QAnBuB,iBAAY,GAAZ,YAAY,CAA4B;IAoBrE,CAAC;;AAtBuB,aAAS,GAAG,OAAO,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
3
|
* Produces an {@apilink Expectation|expectation} that is met when the actual array of `Item[]` contains
|
|
4
4
|
* at least one `Item` that is equal to the resolved value of `expected`.
|
|
@@ -23,5 +23,5 @@ import { Answerable, Expectation } from '@serenity-js/core';
|
|
|
23
23
|
*
|
|
24
24
|
* @group Expectations
|
|
25
25
|
*/
|
|
26
|
-
export declare
|
|
26
|
+
export declare const contain: <Item>(expected: import("@serenity-js/core").Answerable<Item>) => Expectation<Item[]>;
|
|
27
27
|
//# sourceMappingURL=contain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contain.d.ts","sourceRoot":"","sources":["../../src/expectations/contain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"contain.d.ts","sourceRoot":"","sources":["../../src/expectations/contain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,uFAInB,CAAC"}
|
|
@@ -27,9 +27,5 @@ const objects_1 = require("tiny-types/lib/objects");
|
|
|
27
27
|
*
|
|
28
28
|
* @group Expectations
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
|
-
return core_1.Expectation.thatActualShould('contain', expected)
|
|
32
|
-
.soThat((actualValue, expectedValue) => actualValue.some(item => (0, objects_1.equal)(item, expectedValue)));
|
|
33
|
-
}
|
|
34
|
-
exports.contain = contain;
|
|
30
|
+
exports.contain = core_1.Expectation.define('contain', 'contain', (actual, expected) => actual.some(item => (0, objects_1.equal)(item, expected)));
|
|
35
31
|
//# sourceMappingURL=contain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contain.js","sourceRoot":"","sources":["../../src/expectations/contain.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"contain.js","sourceRoot":"","sources":["../../src/expectations/contain.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAChD,oDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACU,QAAA,OAAO,GAAG,kBAAW,CAAC,MAAM,CACrC,SAAS,EAAE,SAAS,EACpB,CAAO,MAAc,EAAE,QAAc,EAAE,EAAE,CACrC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAA,eAAK,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CACjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containAtLeastOneItemThat.d.ts","sourceRoot":"","sources":["../../src/expectations/containAtLeastOneItemThat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,WAAW,
|
|
1
|
+
{"version":3,"file":"containAtLeastOneItemThat.d.ts","sourceRoot":"","sources":["../../src/expectations/containAtLeastOneItemThat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,WAAW,EAAyF,MAAM,mBAAmB,CAAC;AAExK;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAEnG"}
|
|
@@ -35,19 +35,20 @@ class ContainAtLeastOneItemThatMeetsExpectation extends core_1.Expectation {
|
|
|
35
35
|
return (0, core_1.d) `contain at least one item that does ${expectation}`;
|
|
36
36
|
}
|
|
37
37
|
constructor(expectation) {
|
|
38
|
-
super(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), async (actor, actual) => {
|
|
38
|
+
super('containAtLeastOneItemThat', ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), async (actor, actual) => {
|
|
39
39
|
const items = await actor.answer(actual);
|
|
40
40
|
if (!items || items.length === 0) {
|
|
41
|
-
|
|
41
|
+
const unanswered = new core_1.Unanswered();
|
|
42
|
+
return new core_1.ExpectationNotMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), core_1.ExpectationDetails.of('containAtLeastOneItemThat', unanswered), unanswered, items);
|
|
42
43
|
}
|
|
43
44
|
let outcome;
|
|
44
45
|
for (const item of items) {
|
|
45
46
|
outcome = await actor.answer(expectation.isMetFor(item));
|
|
46
47
|
if (outcome instanceof core_1.ExpectationMet) {
|
|
47
|
-
return new core_1.ExpectationMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
48
|
+
return new core_1.ExpectationMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), core_1.ExpectationDetails.of('containAtLeastOneItemThat', outcome.expectation), outcome.expected, items);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
return new core_1.ExpectationNotMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
51
|
+
return new core_1.ExpectationNotMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), core_1.ExpectationDetails.of('containAtLeastOneItemThat', outcome.expectation), outcome.expected, items);
|
|
51
52
|
});
|
|
52
53
|
this.expectation = expectation;
|
|
53
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containAtLeastOneItemThat.js","sourceRoot":"","sources":["../../src/expectations/containAtLeastOneItemThat.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"containAtLeastOneItemThat.js","sourceRoot":"","sources":["../../src/expectations/containAtLeastOneItemThat.ts"],"names":[],"mappings":";;;AAAA,4CAAwK;AAExK;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,yBAAyB,CAAO,WAA8B;IAC1E,OAAO,IAAI,yCAAyC,CAAC,WAAW,CAAC,CAAC;AACtE,CAAC;AAFD,8DAEC;AAED;;GAEG;AACH,MAAM,yCAAgD,SAAQ,kBAAmB;IAErE,MAAM,CAAC,cAAc,CAAC,WAA6B;QACvD,OAAO,IAAA,QAAC,EAAA,uCAAwC,WAAY,EAAE,CAAC;IACnE,CAAC;IAED,YAA6B,WAA8B;QACvD,KAAK,CACD,2BAA2B,EAC3B,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,KAAK,EAAE,KAAuB,EAAE,MAA0B,EAAE,EAAE;YAE1D,MAAM,KAAK,GAAW,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEjD,IAAI,CAAE,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,MAAM,UAAU,GAAG,IAAI,iBAAU,EAAE,CAAC;gBACpC,OAAO,IAAI,wBAAiB,CACxB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,yBAAkB,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAU,CAAC,EAC9D,UAAU,EACV,KAAK,CACR,CAAC;aACL;YAED,IAAI,OAA2B,CAAC;YAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBAEtB,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;gBAExD,IAAI,OAAO,YAAY,qBAAc,EAAE;oBACnC,OAAO,IAAI,qBAAc,CACrB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,yBAAkB,CAAC,EAAE,CAAC,2BAA2B,EAAE,OAAO,CAAC,WAAW,CAAC,EACvE,OAAO,CAAC,QAAQ,EAChB,KAAK,CACR,CAAC;iBACL;aACJ;YAED,OAAO,IAAI,wBAAiB,CACxB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,yBAAkB,CAAC,EAAE,CAAC,2BAA2B,EAAE,OAAO,CAAC,WAAW,CAAC,EACvE,OAAO,CAAC,QAAQ,EAChB,KAAK,CACR,CAAC;QACN,CAAC,CACJ,CAAC;QAzCuB,gBAAW,GAAX,WAAW,CAAmB;IA0C3D,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containItemsWhereEachItem.d.ts","sourceRoot":"","sources":["../../src/expectations/containItemsWhereEachItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,WAAW,
|
|
1
|
+
{"version":3,"file":"containItemsWhereEachItem.d.ts","sourceRoot":"","sources":["../../src/expectations/containItemsWhereEachItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,WAAW,EAAyF,MAAM,mBAAmB,CAAC;AAExK;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAEzG"}
|
|
@@ -35,19 +35,20 @@ class ContainItemsWhereEachItemMeetsExpectation extends core_1.Expectation {
|
|
|
35
35
|
return (0, core_1.d) `contain items where each item does ${expectation}`;
|
|
36
36
|
}
|
|
37
37
|
constructor(expectation) {
|
|
38
|
-
super(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), async (actor, actual) => {
|
|
38
|
+
super('containItemsWhereEachItem', ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), async (actor, actual) => {
|
|
39
39
|
const items = await actor.answer(actual);
|
|
40
40
|
if (!items || items.length === 0) {
|
|
41
|
-
|
|
41
|
+
const unanswered = new core_1.Unanswered();
|
|
42
|
+
return new core_1.ExpectationNotMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), core_1.ExpectationDetails.of('containItemsWhereEachItem', unanswered), unanswered, items);
|
|
42
43
|
}
|
|
43
44
|
let outcome;
|
|
44
45
|
for (const item of items) {
|
|
45
46
|
outcome = await actor.answer(expectation.isMetFor(item));
|
|
46
47
|
if (outcome instanceof core_1.ExpectationNotMet) {
|
|
47
|
-
return new core_1.ExpectationNotMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
48
|
+
return new core_1.ExpectationNotMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), core_1.ExpectationDetails.of('containItemsWhereEachItem', outcome.expectation), outcome.expected, items);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
return new core_1.ExpectationMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
51
|
+
return new core_1.ExpectationMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), core_1.ExpectationDetails.of('containItemsWhereEachItem', outcome.expectation), outcome.expected, items);
|
|
51
52
|
});
|
|
52
53
|
this.expectation = expectation;
|
|
53
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containItemsWhereEachItem.js","sourceRoot":"","sources":["../../src/expectations/containItemsWhereEachItem.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"containItemsWhereEachItem.js","sourceRoot":"","sources":["../../src/expectations/containItemsWhereEachItem.ts"],"names":[],"mappings":";;;AAAA,4CAAwK;AAExK;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,yBAAyB,CAAS,WAAgC;IAC9E,OAAO,IAAI,yCAAyC,CAAC,WAAW,CAAC,CAAC;AACtE,CAAC;AAFD,8DAEC;AAED;;GAEG;AACH,MAAM,yCAAkD,SAAQ,kBAAqB;IAEzE,MAAM,CAAC,cAAc,CAAC,WAA6B;QACvD,OAAO,IAAA,QAAC,EAAA,sCAAuC,WAAY,EAAE,CAAC;IAClE,CAAC;IAED,YAA6B,WAAgC;QACzD,KAAK,CACD,2BAA2B,EAC3B,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,KAAK,EAAE,KAAuB,EAAE,MAA4B,EAAE,EAAE;YAE5D,MAAM,KAAK,GAAa,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEnD,IAAI,CAAE,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,MAAM,UAAU,GAAG,IAAI,iBAAU,EAAE,CAAC;gBACpC,OAAO,IAAI,wBAAiB,CACxB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,yBAAkB,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAU,CAAC,EAC9D,UAAU,EACV,KAAK,CACR,CAAC;aACL;YAED,IAAI,OAA2B,CAAC;YAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBAEtB,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;gBAExD,IAAI,OAAO,YAAY,wBAAiB,EAAE;oBACtC,OAAO,IAAI,wBAAiB,CACxB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,yBAAkB,CAAC,EAAE,CAAC,2BAA2B,EAAE,OAAO,CAAC,WAAW,CAAC,EACvE,OAAO,CAAC,QAAQ,EAChB,KAAK,CACR,CAAC;iBACL;aACJ;YAED,OAAO,IAAI,qBAAc,CACrB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,yBAAkB,CAAC,EAAE,CAAC,2BAA2B,EAAE,OAAO,CAAC,WAAW,CAAC,EACvE,OAAO,CAAC,QAAQ,EAChB,KAAK,CACR,CAAC;QACN,CAAC,CACJ,CAAC;QAzCuB,gBAAW,GAAX,WAAW,CAAqB;IA0C7D,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
3
|
* Creates an {@apilink Expectation|expectation} that is met when the actual `string` value
|
|
4
4
|
* ends with the resolved value of `expected`.
|
|
@@ -18,5 +18,5 @@ import { Answerable, Expectation } from '@serenity-js/core';
|
|
|
18
18
|
*
|
|
19
19
|
* @group Expectations
|
|
20
20
|
*/
|
|
21
|
-
export declare
|
|
21
|
+
export declare const endsWith: (expected: import("@serenity-js/core").Answerable<string>) => Expectation<string>;
|
|
22
22
|
//# sourceMappingURL=endsWith.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endsWith.d.ts","sourceRoot":"","sources":["../../src/expectations/endsWith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"endsWith.d.ts","sourceRoot":"","sources":["../../src/expectations/endsWith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,mFAIpB,CAAA"}
|
|
@@ -21,9 +21,5 @@ const core_1 = require("@serenity-js/core");
|
|
|
21
21
|
*
|
|
22
22
|
* @group Expectations
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
return core_1.Expectation.thatActualShould('end with', expected)
|
|
26
|
-
.soThat((actualValue, expectedValue) => actualValue.endsWith(expectedValue));
|
|
27
|
-
}
|
|
28
|
-
exports.endsWith = endsWith;
|
|
24
|
+
exports.endsWith = core_1.Expectation.define('endsWith', 'end with', (actual, expected) => actual.endsWith(expected));
|
|
29
25
|
//# sourceMappingURL=endsWith.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endsWith.js","sourceRoot":"","sources":["../../src/expectations/endsWith.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"endsWith.js","sourceRoot":"","sources":["../../src/expectations/endsWith.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,QAAQ,GAAG,kBAAW,CAAC,MAAM,CACtC,UAAU,EAAE,UAAU,EACtB,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE,CACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAChC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
3
|
* Produces an {@apilink Expectation|expectation} that is met when the actual value
|
|
4
4
|
* is equal to the resolved value of `expectedValue`.
|
|
@@ -24,5 +24,5 @@ import { Answerable, Expectation } from '@serenity-js/core';
|
|
|
24
24
|
*
|
|
25
25
|
* @group Expectations
|
|
26
26
|
*/
|
|
27
|
-
export declare
|
|
27
|
+
export declare const equals: <T>(expected: import("@serenity-js/core").Answerable<T>) => Expectation<T>;
|
|
28
28
|
//# sourceMappingURL=equals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equals.d.ts","sourceRoot":"","sources":["../../src/expectations/equals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"equals.d.ts","sourceRoot":"","sources":["../../src/expectations/equals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,MAAM,4EAIlB,CAAC"}
|
|
@@ -28,9 +28,5 @@ const objects_1 = require("tiny-types/lib/objects");
|
|
|
28
28
|
*
|
|
29
29
|
* @group Expectations
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
|
-
return core_1.Expectation.thatActualShould('equal', expectedValue)
|
|
33
|
-
.soThat((actual, expected) => (0, objects_1.equal)(actual, expected));
|
|
34
|
-
}
|
|
35
|
-
exports.equals = equals;
|
|
31
|
+
exports.equals = core_1.Expectation.define('equals', 'equal', (actual, expected) => (0, objects_1.equal)(actual, expected));
|
|
36
32
|
//# sourceMappingURL=equals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equals.js","sourceRoot":"","sources":["../../src/expectations/equals.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"equals.js","sourceRoot":"","sources":["../../src/expectations/equals.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAChD,oDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,MAAM,GAAG,kBAAW,CAAC,MAAM,CACpC,QAAQ,EAAE,OAAO,EACjB,CAAI,MAAS,EAAE,QAAW,EAAE,EAAE,CAC1B,IAAA,eAAK,EAAC,MAAM,EAAE,QAAQ,CAAC,CAC9B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
3
|
* Creates an {@apilink Expectation|expectation} that is met when the actual `string` value
|
|
4
4
|
* includes a substring of `expected`.
|
|
@@ -18,5 +18,5 @@ import { Answerable, Expectation } from '@serenity-js/core';
|
|
|
18
18
|
*
|
|
19
19
|
* @group Expectations
|
|
20
20
|
*/
|
|
21
|
-
export declare
|
|
21
|
+
export declare const includes: (expected: import("@serenity-js/core").Answerable<string>) => Expectation<string>;
|
|
22
22
|
//# sourceMappingURL=includes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"includes.d.ts","sourceRoot":"","sources":["../../src/expectations/includes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"includes.d.ts","sourceRoot":"","sources":["../../src/expectations/includes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,mFAIpB,CAAC"}
|
|
@@ -21,9 +21,5 @@ const core_1 = require("@serenity-js/core");
|
|
|
21
21
|
*
|
|
22
22
|
* @group Expectations
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
return core_1.Expectation.thatActualShould('include', expected)
|
|
26
|
-
.soThat((actualValue, expectedValue) => actualValue.includes(expectedValue));
|
|
27
|
-
}
|
|
28
|
-
exports.includes = includes;
|
|
24
|
+
exports.includes = core_1.Expectation.define('includes', 'include', (actual, expected) => actual.includes(expected));
|
|
29
25
|
//# sourceMappingURL=includes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"includes.js","sourceRoot":"","sources":["../../src/expectations/includes.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"includes.js","sourceRoot":"","sources":["../../src/expectations/includes.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,QAAQ,GAAG,kBAAW,CAAC,MAAM,CACtC,UAAU,EAAE,SAAS,EACrB,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE,CACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAChC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
3
|
* Creates an {@apilink Expectation|expectation} that is met when the actual value of type `Date`
|
|
4
4
|
* is after the expected `Date`.
|
|
@@ -38,5 +38,5 @@ import { Answerable, Expectation } from '@serenity-js/core';
|
|
|
38
38
|
*
|
|
39
39
|
* @group Expectations
|
|
40
40
|
*/
|
|
41
|
-
export declare
|
|
41
|
+
export declare const isAfter: (expected: import("@serenity-js/core").Answerable<Date>) => Expectation<Date>;
|
|
42
42
|
//# sourceMappingURL=isAfter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAfter.d.ts","sourceRoot":"","sources":["../../src/expectations/isAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"isAfter.d.ts","sourceRoot":"","sources":["../../src/expectations/isAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,OAAO,+EAInB,CAAC"}
|
|
@@ -41,9 +41,5 @@ const core_1 = require("@serenity-js/core");
|
|
|
41
41
|
*
|
|
42
42
|
* @group Expectations
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
|
-
return core_1.Expectation.thatActualShould('have value that is after', expected)
|
|
46
|
-
.soThat((actualValue, expectedValue) => actualValue.getTime() > expectedValue.getTime());
|
|
47
|
-
}
|
|
48
|
-
exports.isAfter = isAfter;
|
|
44
|
+
exports.isAfter = core_1.Expectation.define('isAfter', 'have value that is after', (actual, expected) => actual.getTime() > expected.getTime());
|
|
49
45
|
//# sourceMappingURL=isAfter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAfter.js","sourceRoot":"","sources":["../../src/expectations/isAfter.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"isAfter.js","sourceRoot":"","sources":["../../src/expectations/isAfter.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACU,QAAA,OAAO,GAAG,kBAAW,CAAC,MAAM,CACrC,SAAS,EAAE,0BAA0B,EACrC,CAAC,MAAY,EAAE,QAAc,EAAE,EAAE,CAC7B,MAAM,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,CAC5C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
3
|
* Creates an {@apilink Expectation|expectation} that is met when the actual value of type `Date`
|
|
4
4
|
* is before the expected `Date`.
|
|
@@ -38,5 +38,5 @@ import { Answerable, Expectation } from '@serenity-js/core';
|
|
|
38
38
|
*
|
|
39
39
|
* @group Expectations
|
|
40
40
|
*/
|
|
41
|
-
export declare
|
|
41
|
+
export declare const isBefore: (expected: import("@serenity-js/core").Answerable<Date>) => Expectation<Date>;
|
|
42
42
|
//# sourceMappingURL=isBefore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBefore.d.ts","sourceRoot":"","sources":["../../src/expectations/isBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"isBefore.d.ts","sourceRoot":"","sources":["../../src/expectations/isBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,QAAQ,+EAIpB,CAAC"}
|
|
@@ -41,9 +41,5 @@ const core_1 = require("@serenity-js/core");
|
|
|
41
41
|
*
|
|
42
42
|
* @group Expectations
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
|
-
return core_1.Expectation.thatActualShould('have value that is before', expected)
|
|
46
|
-
.soThat((actualValue, expectedValue) => actualValue.getTime() < expectedValue.getTime());
|
|
47
|
-
}
|
|
48
|
-
exports.isBefore = isBefore;
|
|
44
|
+
exports.isBefore = core_1.Expectation.define('isBefore', 'have value that is before', (actual, expected) => actual.getTime() < expected.getTime());
|
|
49
45
|
//# sourceMappingURL=isBefore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBefore.js","sourceRoot":"","sources":["../../src/expectations/isBefore.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"isBefore.js","sourceRoot":"","sources":["../../src/expectations/isBefore.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACU,QAAA,QAAQ,GAAG,kBAAW,CAAC,MAAM,CACtC,UAAU,EAAE,2BAA2B,EACvC,CAAC,MAAY,EAAE,QAAc,EAAE,EAAE,CAC7B,MAAM,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,CAC5C,CAAC"}
|