@serenity-js/assertions 2.33.1 → 3.0.0-rc.11
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 +274 -3
- package/lib/Ensure.d.ts +1 -1
- package/lib/Ensure.js +7 -10
- package/lib/Ensure.js.map +1 -1
- package/lib/expectations/and.d.ts +1 -1
- package/lib/expectations/and.js +6 -6
- package/lib/expectations/and.js.map +1 -1
- package/lib/expectations/contain.d.ts +1 -1
- package/lib/expectations/containAtLeastOneItemThat.d.ts +1 -1
- package/lib/expectations/containAtLeastOneItemThat.js +16 -9
- package/lib/expectations/containAtLeastOneItemThat.js.map +1 -1
- package/lib/expectations/containItemsWhereEachItem.d.ts +1 -1
- package/lib/expectations/containItemsWhereEachItem.js +16 -9
- package/lib/expectations/containItemsWhereEachItem.js.map +1 -1
- package/lib/expectations/index.d.ts +1 -1
- package/lib/expectations/index.js +1 -1
- package/lib/expectations/index.js.map +1 -1
- package/lib/expectations/isFalse.js.map +1 -1
- package/lib/expectations/isPresent.d.ts +14 -0
- package/lib/expectations/isPresent.js +50 -0
- package/lib/expectations/isPresent.js.map +1 -0
- package/lib/expectations/isTrue.js.map +1 -1
- package/lib/expectations/matches.d.ts +1 -1
- package/lib/expectations/not.d.ts +1 -1
- package/lib/expectations/not.js +7 -8
- package/lib/expectations/not.js.map +1 -1
- package/lib/expectations/or.d.ts +1 -1
- package/lib/expectations/or.js +17 -12
- package/lib/expectations/or.js.map +1 -1
- package/package.json +7 -7
- package/src/Ensure.ts +17 -21
- package/src/expectations/and.ts +19 -18
- package/src/expectations/contain.ts +1 -1
- package/src/expectations/containAtLeastOneItemThat.ts +38 -14
- package/src/expectations/containItemsWhereEachItem.ts +38 -14
- package/src/expectations/index.ts +1 -1
- package/src/expectations/isFalse.ts +1 -1
- package/src/expectations/isPresent.ts +58 -0
- package/src/expectations/isTrue.ts +1 -1
- package/src/expectations/matches.ts +1 -1
- package/src/expectations/not.ts +15 -15
- package/src/expectations/or.ts +28 -25
- package/lib/expectations/property.d.ts +0 -2
- package/lib/expectations/property.js +0 -28
- package/lib/expectations/property.js.map +0 -1
- package/src/expectations/property.ts +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,280 @@
|
|
|
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.11](https://github.com/serenity-js/serenity-js/compare/v2.33.1...v3.0.0-rc.11) (2022-02-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# [3.0.0-rc.10](https://github.com/serenity-js/serenity-js/compare/v2.33.0...v3.0.0-rc.10) (2022-02-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.0.0-rc.9](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.8...v3.0.0-rc.9) (2022-02-01)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [3.0.0-rc.8](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.7...v3.0.0-rc.8) (2022-01-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [3.0.0-rc.7](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.6...v3.0.0-rc.7) (2022-01-28)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **assertions:** isPresent works with any Optional ([cea75dc](https://github.com/serenity-js/serenity-js/commit/cea75dc1c728e45e06a87aaf9c1573a237334285)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
28
|
+
* **core:** replaced `Adapter` with `QuestionAdapter` and introduced `Optional` ([8d84ad3](https://github.com/serenity-js/serenity-js/commit/8d84ad3863e3c726533d0f21934fb1e2fa8b3022)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
29
|
+
* **core:** support for Optional chaining, expectation isPresent, refactored Expectations ([1841ee5](https://github.com/serenity-js/serenity-js/commit/1841ee5fc48cfa403ddc53358f75764d9a010c21)), closes [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [3.0.0-rc.6](https://github.com/serenity-js/serenity-js/compare/v2.32.7...v3.0.0-rc.6) (2022-01-10)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
* **deps:** updated tiny-types to 1.17.0 ([3187051](https://github.com/serenity-js/serenity-js/commit/3187051594158b4b450c82e851e417fd2ed21652))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# [3.0.0-rc.2](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.1...v3.0.0-rc.2) (2021-12-09)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# [3.0.0-rc.1](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.0...v3.0.0-rc.1) (2021-12-09)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Bug Fixes
|
|
66
|
+
|
|
67
|
+
* **core:** 3.0 RC ([469d54e](https://github.com/serenity-js/serenity-js/commit/469d54e4f81ef430566b93852e3174826f8ef672)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### BREAKING CHANGES
|
|
71
|
+
|
|
72
|
+
* **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
|
|
73
|
+
modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# [3.0.0-rc.10](https://github.com/serenity-js/serenity-js/compare/v2.33.0...v3.0.0-rc.10) (2022-02-03)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# [3.0.0-rc.9](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.8...v3.0.0-rc.9) (2022-02-01)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# [3.0.0-rc.8](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.7...v3.0.0-rc.8) (2022-01-28)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# [3.0.0-rc.7](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.6...v3.0.0-rc.7) (2022-01-28)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Features
|
|
95
|
+
|
|
96
|
+
* **assertions:** isPresent works with any Optional ([cea75dc](https://github.com/serenity-js/serenity-js/commit/cea75dc1c728e45e06a87aaf9c1573a237334285)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
97
|
+
* **core:** replaced `Adapter` with `QuestionAdapter` and introduced `Optional` ([8d84ad3](https://github.com/serenity-js/serenity-js/commit/8d84ad3863e3c726533d0f21934fb1e2fa8b3022)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
98
|
+
* **core:** support for Optional chaining, expectation isPresent, refactored Expectations ([1841ee5](https://github.com/serenity-js/serenity-js/commit/1841ee5fc48cfa403ddc53358f75764d9a010c21)), closes [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [3.0.0-rc.6](https://github.com/serenity-js/serenity-js/compare/v2.32.7...v3.0.0-rc.6) (2022-01-10)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Bug Fixes
|
|
118
|
+
|
|
119
|
+
* **deps:** updated tiny-types to 1.17.0 ([3187051](https://github.com/serenity-js/serenity-js/commit/3187051594158b4b450c82e851e417fd2ed21652))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# [3.0.0-rc.2](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.1...v3.0.0-rc.2) (2021-12-09)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# [3.0.0-rc.1](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.0...v3.0.0-rc.1) (2021-12-09)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
# [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Bug Fixes
|
|
135
|
+
|
|
136
|
+
* **core:** 3.0 RC ([469d54e](https://github.com/serenity-js/serenity-js/commit/469d54e4f81ef430566b93852e3174826f8ef672)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### BREAKING CHANGES
|
|
140
|
+
|
|
141
|
+
* **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
|
|
142
|
+
modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# [3.0.0-rc.9](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.8...v3.0.0-rc.9) (2022-02-01)
|
|
149
|
+
|
|
150
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# [3.0.0-rc.8](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.7...v3.0.0-rc.8) (2022-01-28)
|
|
157
|
+
|
|
158
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# [3.0.0-rc.7](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.6...v3.0.0-rc.7) (2022-01-28)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Features
|
|
168
|
+
|
|
169
|
+
* **assertions:** isPresent works with any Optional ([cea75dc](https://github.com/serenity-js/serenity-js/commit/cea75dc1c728e45e06a87aaf9c1573a237334285)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
170
|
+
* **core:** replaced `Adapter` with `QuestionAdapter` and introduced `Optional` ([8d84ad3](https://github.com/serenity-js/serenity-js/commit/8d84ad3863e3c726533d0f21934fb1e2fa8b3022)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
171
|
+
* **core:** support for Optional chaining, expectation isPresent, refactored Expectations ([1841ee5](https://github.com/serenity-js/serenity-js/commit/1841ee5fc48cfa403ddc53358f75764d9a010c21)), closes [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
# [3.0.0-rc.6](https://github.com/serenity-js/serenity-js/compare/v2.32.7...v3.0.0-rc.6) (2022-01-10)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
# [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
# [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
# [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Bug Fixes
|
|
193
|
+
|
|
194
|
+
* **deps:** updated tiny-types to 1.17.0 ([3187051](https://github.com/serenity-js/serenity-js/commit/3187051594158b4b450c82e851e417fd2ed21652))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
# [3.0.0-rc.2](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.1...v3.0.0-rc.2) (2021-12-09)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
# [3.0.0-rc.1](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.0...v3.0.0-rc.1) (2021-12-09)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Bug Fixes
|
|
210
|
+
|
|
211
|
+
* **core:** 3.0 RC ([469d54e](https://github.com/serenity-js/serenity-js/commit/469d54e4f81ef430566b93852e3174826f8ef672)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### BREAKING CHANGES
|
|
215
|
+
|
|
216
|
+
* **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
|
|
217
|
+
modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
|
|
224
|
+
|
|
225
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
# [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
|
|
232
|
+
|
|
233
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
# [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
### Bug Fixes
|
|
243
|
+
|
|
244
|
+
* **deps:** updated tiny-types to 1.17.0 ([3187051](https://github.com/serenity-js/serenity-js/commit/3187051594158b4b450c82e851e417fd2ed21652))
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# [3.0.0-rc.2](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.1...v3.0.0-rc.2) (2021-12-09)
|
|
251
|
+
|
|
252
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
# [3.0.0-rc.1](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.0...v3.0.0-rc.1) (2021-12-09)
|
|
259
|
+
|
|
260
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
# [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
### Bug Fixes
|
|
270
|
+
|
|
271
|
+
* **core:** 3.0 RC ([469d54e](https://github.com/serenity-js/serenity-js/commit/469d54e4f81ef430566b93852e3174826f8ef672)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
### BREAKING CHANGES
|
|
275
|
+
|
|
276
|
+
* **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
|
|
277
|
+
modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
|
|
278
|
+
|
|
279
|
+
|
|
6
280
|
## [2.33.1](https://github.com/serenity-js/serenity-js/compare/v2.33.0...v2.33.1) (2022-02-10)
|
|
7
281
|
|
|
8
282
|
|
|
@@ -35,9 +309,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
35
309
|
**Note:** Version bump only for package @serenity-js/assertions
|
|
36
310
|
|
|
37
311
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
312
|
## [2.32.5](https://github.com/serenity-js/serenity-js/compare/v2.32.4...v2.32.5) (2021-12-08)
|
|
42
313
|
|
|
43
314
|
**Note:** Version bump only for package @serenity-js/assertions
|
package/lib/Ensure.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare class Ensure<Actual> extends Interaction {
|
|
|
52
52
|
*
|
|
53
53
|
* @returns {Ensure<A>}
|
|
54
54
|
*/
|
|
55
|
-
static that<A>(actual: Answerable<A>, expectation: Expectation<
|
|
55
|
+
static that<A>(actual: Answerable<A>, expectation: Expectation<A>): Ensure<A>;
|
|
56
56
|
/**
|
|
57
57
|
* @param {@serenity-js/core/lib/screenplay~Answerable<T>} actual
|
|
58
58
|
* @param {@serenity-js/core/lib/screenplay/questions~Expectation<T>} expectation
|
package/lib/Ensure.js
CHANGED
|
@@ -2,7 +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 io_1 = require("@serenity-js/core/lib/io");
|
|
6
5
|
const inspected_1 = require("@serenity-js/core/lib/io/inspected");
|
|
7
6
|
const model_1 = require("@serenity-js/core/lib/model");
|
|
8
7
|
const tiny_types_1 = require("tiny-types");
|
|
@@ -82,19 +81,17 @@ class Ensure extends core_1.Interaction {
|
|
|
82
81
|
* @see {@link @serenity-js/core/lib/screenplay/actor~CollectsArtifacts}
|
|
83
82
|
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
84
83
|
*/
|
|
85
|
-
performAs(actor) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
actor.answer(this.expectation),
|
|
89
|
-
]).then(([actual, expectation]) => expectation(actual).then(outcome => (0, tiny_types_1.match)(outcome)
|
|
84
|
+
async performAs(actor) {
|
|
85
|
+
const outcome = await actor.answer(this.expectation.isMetFor(this.actual));
|
|
86
|
+
return (0, tiny_types_1.match)(outcome)
|
|
90
87
|
.when(core_1.ExpectationNotMet, o => {
|
|
91
88
|
actor.collect(this.artifactFrom(o.expected, o.actual), new model_1.Name(`Assertion Report`));
|
|
92
89
|
throw this.errorForOutcome(o);
|
|
93
90
|
})
|
|
94
91
|
.when(core_1.ExpectationMet, _ => void 0)
|
|
95
92
|
.else(o => {
|
|
96
|
-
throw new core_1.LogicError((0,
|
|
97
|
-
})
|
|
93
|
+
throw new core_1.LogicError((0, core_1.f) `Expectation#isMetFor(actual) should return an instance of an ExpectationOutcome, not ${o}`);
|
|
94
|
+
});
|
|
98
95
|
}
|
|
99
96
|
/**
|
|
100
97
|
* @desc
|
|
@@ -103,7 +100,7 @@ class Ensure extends core_1.Interaction {
|
|
|
103
100
|
* @returns {string}
|
|
104
101
|
*/
|
|
105
102
|
toString() {
|
|
106
|
-
return (0,
|
|
103
|
+
return (0, core_1.d) `#actor ensures that ${this.actual} does ${this.expectation}`;
|
|
107
104
|
}
|
|
108
105
|
/**
|
|
109
106
|
* @desc
|
|
@@ -143,7 +140,7 @@ class Ensure extends core_1.Interaction {
|
|
|
143
140
|
* @protected
|
|
144
141
|
*/
|
|
145
142
|
asAssertionError(outcome) {
|
|
146
|
-
return new core_1.AssertionError(`Expected ${(0,
|
|
143
|
+
return new core_1.AssertionError(`Expected ${(0, core_1.d) `${this.actual}`} to ${outcome.message}`, outcome.expected, outcome.actual);
|
|
147
144
|
}
|
|
148
145
|
artifactFrom(expected, actual) {
|
|
149
146
|
return model_1.AssertionReport.fromJSON({
|
package/lib/Ensure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ensure.js","sourceRoot":"","sources":["../src/Ensure.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Ensure.js","sourceRoot":"","sources":["../src/Ensure.ts"],"names":[],"mappings":";;;AAAA,4CAe2B;AAC3B,kEAA+D;AAC/D,uDAA8E;AAC9E,2CAAmC;AAEnC;;;;;;;;;;;;;;;;;;;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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
|
-
export declare function and<Actual>(...expectations: Array<Expectation<
|
|
2
|
+
export declare function and<Actual>(...expectations: Array<Expectation<Actual>>): Expectation<Actual>;
|
package/lib/expectations/and.js
CHANGED
|
@@ -12,13 +12,13 @@ exports.and = and;
|
|
|
12
12
|
*/
|
|
13
13
|
class And extends core_1.Expectation {
|
|
14
14
|
constructor(expectations) {
|
|
15
|
-
super(expectations.map(
|
|
15
|
+
super(expectations.map(expectation => expectation.toString()).join(And.Separator), (actor, actual) => {
|
|
16
|
+
return expectations.reduce((previous, current) => previous.then(outcome => (0, tiny_types_1.match)(outcome)
|
|
17
|
+
.when(core_1.ExpectationNotMet, o => o)
|
|
18
|
+
.else(_ => actor.answer(current.isMetFor(actual)))), Promise.resolve(void 0));
|
|
19
|
+
});
|
|
16
20
|
this.expectations = expectations;
|
|
17
21
|
}
|
|
18
|
-
answeredBy(actor) {
|
|
19
|
-
return (actual) => this.expectations.reduce((previous, current) => previous.then(outcome => (0, tiny_types_1.match)(outcome)
|
|
20
|
-
.when(core_1.ExpectationNotMet, o => o)
|
|
21
|
-
.else(_ => current.answeredBy(actor)(actual))), Promise.resolve(void 0));
|
|
22
|
-
}
|
|
23
22
|
}
|
|
23
|
+
And.Separator = ' and ';
|
|
24
24
|
//# sourceMappingURL=and.js.map
|
|
@@ -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,4CAAiG;AACjG,2CAAmC;AAEnC,SAAgB,GAAG,CAAS,GAAG,YAAwC;IACnE,OAAO,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;AACjC,CAAC;AAFD,kBAEC;AAED;;GAEG;AACH,MAAM,GAAY,SAAQ,kBAAmB;IAGzC,YAA6B,YAAwC;QACjE,KAAK,CACD,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAC3E,CAAC,KAAuB,EAAE,MAA0B,EAAE,EAAE;YACpD,OAAO,YAAY,CAAC,MAAM,CACtB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAClB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CACpB,IAAA,kBAAK,EAAC,OAAO,CAAC;iBACT,IAAI,CAAC,wBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBAC/B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CACzD,EACL,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAC1B,CAAC;QACN,CAAC,CACJ,CAAC;QAduB,iBAAY,GAAZ,YAAY,CAA4B;IAerE,CAAC;;AAjBuB,aAAS,GAAG,OAAO,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Answerable, Expectation } from '@serenity-js/core';
|
|
2
|
-
export declare function contain<Item>(expected: Answerable<Item>): Expectation<Item
|
|
2
|
+
export declare function contain<Item>(expected: Answerable<Item>): Expectation<Item[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
|
-
export declare function containAtLeastOneItemThat<Actual>(expectation: Expectation<
|
|
2
|
+
export declare function containAtLeastOneItemThat<Actual>(expectation: Expectation<Actual>): Expectation<Actual[]>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.containAtLeastOneItemThat = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
5
|
function containAtLeastOneItemThat(expectation) {
|
|
7
6
|
return new ContainAtLeastOneItemThatMeetsExpectation(expectation);
|
|
8
7
|
}
|
|
@@ -12,16 +11,24 @@ exports.containAtLeastOneItemThat = containAtLeastOneItemThat;
|
|
|
12
11
|
*/
|
|
13
12
|
class ContainAtLeastOneItemThatMeetsExpectation extends core_1.Expectation {
|
|
14
13
|
constructor(expectation) {
|
|
15
|
-
super((
|
|
14
|
+
super(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), async (actor, actual) => {
|
|
15
|
+
const items = await actor.answer(actual);
|
|
16
|
+
if (!items || items.length === 0) {
|
|
17
|
+
return new core_1.ExpectationNotMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), undefined, items);
|
|
18
|
+
}
|
|
19
|
+
let outcome;
|
|
20
|
+
for (const item of items) {
|
|
21
|
+
outcome = await actor.answer(expectation.isMetFor(item));
|
|
22
|
+
if (outcome instanceof core_1.ExpectationMet) {
|
|
23
|
+
return new core_1.ExpectationMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return new core_1.ExpectationNotMet(ContainAtLeastOneItemThatMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
27
|
+
});
|
|
16
28
|
this.expectation = expectation;
|
|
17
29
|
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
? Promise.resolve(new core_1.ExpectationNotMet(this.toString(), undefined, actual))
|
|
21
|
-
: Promise.all(actual.map(item => this.expectation.answeredBy(actor)(item)))
|
|
22
|
-
.then(results => results.some(result => result instanceof core_1.ExpectationMet)
|
|
23
|
-
? new core_1.ExpectationMet(this.toString(), results[0].expected, actual)
|
|
24
|
-
: new core_1.ExpectationNotMet(this.toString(), results[0].expected, actual));
|
|
30
|
+
static descriptionFor(expectation) {
|
|
31
|
+
return (0, core_1.d) `contain at least one item that does ${expectation}`;
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
//# sourceMappingURL=containAtLeastOneItemThat.js.map
|
|
@@ -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,4CAAwI;AAExI,SAAgB,yBAAyB,CAAS,WAAgC;IAC9E,OAAO,IAAI,yCAAyC,CAAC,WAAW,CAAC,CAAC;AACtE,CAAC;AAFD,8DAEC;AAED;;GAEG;AACH,MAAM,yCAAkD,SAAQ,kBAAqB;IAMjF,YAA6B,WAAgC;QACzD,KAAK,CACD,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,OAAO,IAAI,wBAAiB,CACxB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,SAAS,EACT,KAAK,CACR,CAAC;aACL;YAED,IAAI,OAA4C,CAAC;YAEjD,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,OAAO,CAAC,QAAQ,EAChB,KAAK,CACR,CAAC;iBACL;aACJ;YAED,OAAO,IAAI,wBAAiB,CAAC,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjI,CAAC,CACJ,CAAC;QAhCuB,gBAAW,GAAX,WAAW,CAAqB;IAiC7D,CAAC;IArCO,MAAM,CAAC,cAAc,CAAC,WAA6B;QACvD,OAAO,IAAA,QAAC,EAAA,uCAAwC,WAAY,EAAE,CAAC;IACnE,CAAC;CAoCJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Expectation } from '@serenity-js/core';
|
|
2
|
-
export declare function containItemsWhereEachItem<Actual>(expectation: Expectation<
|
|
2
|
+
export declare function containItemsWhereEachItem<Actual>(expectation: Expectation<Actual>): Expectation<Actual[]>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.containItemsWhereEachItem = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
5
|
function containItemsWhereEachItem(expectation) {
|
|
7
6
|
return new ContainItemsWhereEachItemMeetsExpectation(expectation);
|
|
8
7
|
}
|
|
@@ -12,16 +11,24 @@ exports.containItemsWhereEachItem = containItemsWhereEachItem;
|
|
|
12
11
|
*/
|
|
13
12
|
class ContainItemsWhereEachItemMeetsExpectation extends core_1.Expectation {
|
|
14
13
|
constructor(expectation) {
|
|
15
|
-
super((
|
|
14
|
+
super(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), async (actor, actual) => {
|
|
15
|
+
const items = await actor.answer(actual);
|
|
16
|
+
if (!items || items.length === 0) {
|
|
17
|
+
return new core_1.ExpectationNotMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), undefined, items);
|
|
18
|
+
}
|
|
19
|
+
let outcome;
|
|
20
|
+
for (const item of items) {
|
|
21
|
+
outcome = await actor.answer(expectation.isMetFor(item));
|
|
22
|
+
if (outcome instanceof core_1.ExpectationNotMet) {
|
|
23
|
+
return new core_1.ExpectationNotMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return new core_1.ExpectationMet(ContainItemsWhereEachItemMeetsExpectation.descriptionFor(expectation), outcome.expected, items);
|
|
27
|
+
});
|
|
16
28
|
this.expectation = expectation;
|
|
17
29
|
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
? Promise.resolve(new core_1.ExpectationNotMet(this.toString(), undefined, actual))
|
|
21
|
-
: Promise.all(actual.map(item => this.expectation.answeredBy(actor)(item)))
|
|
22
|
-
.then(results => results.every(result => result instanceof core_1.ExpectationMet)
|
|
23
|
-
? new core_1.ExpectationMet(this.toString(), results[0].expected, actual)
|
|
24
|
-
: new core_1.ExpectationNotMet(this.toString(), results[0].expected, actual));
|
|
30
|
+
static descriptionFor(expectation) {
|
|
31
|
+
return (0, core_1.d) `contain items where each item does ${expectation}`;
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
//# sourceMappingURL=containItemsWhereEachItem.js.map
|
|
@@ -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,4CAAwI;AAExI,SAAgB,yBAAyB,CAAS,WAAgC;IAC9E,OAAO,IAAI,yCAAyC,CAAC,WAAW,CAAC,CAAC;AACtE,CAAC;AAFD,8DAEC;AAED;;GAEG;AACH,MAAM,yCAAkD,SAAQ,kBAAqB;IAMjF,YAA6B,WAAgC;QACzD,KAAK,CACD,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,OAAO,IAAI,wBAAiB,CACxB,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EACrE,SAAS,EACT,KAAK,CACR,CAAC;aACL;YAED,IAAI,OAA4C,CAAC;YAEjD,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,OAAO,CAAC,QAAQ,EAChB,KAAK,CACR,CAAC;iBACL;aACJ;YAED,OAAO,IAAI,qBAAc,CAAC,yCAAyC,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC9H,CAAC,CACJ,CAAC;QAhCuB,gBAAW,GAAX,WAAW,CAAqB;IAiC7D,CAAC;IArCO,MAAM,CAAC,cAAc,CAAC,WAA6B;QACvD,OAAO,IAAA,QAAC,EAAA,sCAAuC,WAAY,EAAE,CAAC;IAClE,CAAC;CAoCJ"}
|
|
@@ -10,9 +10,9 @@ export * from './isBefore';
|
|
|
10
10
|
export * from './isFalse';
|
|
11
11
|
export * from './isGreaterThan';
|
|
12
12
|
export * from './isLessThan';
|
|
13
|
+
export * from './isPresent';
|
|
13
14
|
export * from './isTrue';
|
|
14
15
|
export * from './matches';
|
|
15
16
|
export * from './not';
|
|
16
17
|
export * from './or';
|
|
17
|
-
export * from './property';
|
|
18
18
|
export * from './startsWith';
|
|
@@ -22,10 +22,10 @@ __exportStar(require("./isBefore"), exports);
|
|
|
22
22
|
__exportStar(require("./isFalse"), exports);
|
|
23
23
|
__exportStar(require("./isGreaterThan"), exports);
|
|
24
24
|
__exportStar(require("./isLessThan"), exports);
|
|
25
|
+
__exportStar(require("./isPresent"), exports);
|
|
25
26
|
__exportStar(require("./isTrue"), exports);
|
|
26
27
|
__exportStar(require("./matches"), exports);
|
|
27
28
|
__exportStar(require("./not"), exports);
|
|
28
29
|
__exportStar(require("./or"), exports);
|
|
29
|
-
__exportStar(require("./property"), exports);
|
|
30
30
|
__exportStar(require("./startsWith"), exports);
|
|
31
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB;AACtB,4CAA0B;AAC1B,8DAA4C;AAC5C,8DAA4C;AAC5C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,kDAAgC;AAChC,+CAA6B;AAC7B,2CAAyB;AACzB,4CAA0B;AAC1B,wCAAsB;AACtB,uCAAqB;AACrB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB;AACtB,4CAA0B;AAC1B,8DAA4C;AAC5C,8DAA4C;AAC5C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,kDAAgC;AAChC,+CAA6B;AAC7B,8CAA4B;AAC5B,2CAAyB;AACzB,4CAA0B;AAC1B,wCAAsB;AACtB,uCAAqB;AACrB,+CAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isFalse.js","sourceRoot":"","sources":["../../src/expectations/isFalse.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,qCAAkC;AAElC,SAAgB,OAAO;IACnB,OAAO,kBAAW,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"isFalse.js","sourceRoot":"","sources":["../../src/expectations/isFalse.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,qCAAkC;AAElC,SAAgB,OAAO;IACnB,OAAO,kBAAW,CAAC,EAAE,CAAiB,aAAa,CAAC,CAAC,YAAY,CAAC,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,CAAC;AACrF,CAAC;AAFD,0BAEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* @desc
|
|
4
|
+
* Expectation that the `actual` is not undefined or null.
|
|
5
|
+
* Also, for `actual` implementing {@link @serenity-js/core/lib/screenplay~Optional}, that `Optional.isPresent()` returns an {@link @serenity-js/core/lib/screenplay~Answerable}
|
|
6
|
+
* that resolves to `true`
|
|
7
|
+
*
|
|
8
|
+
* @returns {@serenity-js/core/lib/screenplay/questions~Expectation<Answerable<boolean>, Optional>}
|
|
9
|
+
*
|
|
10
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
11
|
+
* @see {@link @serenity-js/core/lib/screenplay/questions~Check}
|
|
12
|
+
* @see {@link Wait}
|
|
13
|
+
*/
|
|
14
|
+
export declare function isPresent<Actual>(): Expectation<Actual>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPresent = void 0;
|
|
4
|
+
const core_1 = require("@serenity-js/core");
|
|
5
|
+
/**
|
|
6
|
+
* @desc
|
|
7
|
+
* Expectation that the `actual` is not undefined or null.
|
|
8
|
+
* Also, for `actual` implementing {@link @serenity-js/core/lib/screenplay~Optional}, that `Optional.isPresent()` returns an {@link @serenity-js/core/lib/screenplay~Answerable}
|
|
9
|
+
* that resolves to `true`
|
|
10
|
+
*
|
|
11
|
+
* @returns {@serenity-js/core/lib/screenplay/questions~Expectation<Answerable<boolean>, Optional>}
|
|
12
|
+
*
|
|
13
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
14
|
+
* @see {@link @serenity-js/core/lib/screenplay/questions~Check}
|
|
15
|
+
* @see {@link Wait}
|
|
16
|
+
*/
|
|
17
|
+
function isPresent() {
|
|
18
|
+
return new IsPresent();
|
|
19
|
+
}
|
|
20
|
+
exports.isPresent = isPresent;
|
|
21
|
+
class IsPresent extends core_1.Expectation {
|
|
22
|
+
static isOptional(value) {
|
|
23
|
+
return value !== undefined
|
|
24
|
+
&& value !== null
|
|
25
|
+
&& typeof value.isPresent === 'function';
|
|
26
|
+
}
|
|
27
|
+
static valueToCheck(actual, actor) {
|
|
28
|
+
if (IsPresent.isOptional(actual)) {
|
|
29
|
+
return actual;
|
|
30
|
+
}
|
|
31
|
+
return actor.answer(actual);
|
|
32
|
+
}
|
|
33
|
+
static async isPresent(value, actor) {
|
|
34
|
+
if (IsPresent.isOptional(value)) {
|
|
35
|
+
return actor.answer(value.isPresent());
|
|
36
|
+
}
|
|
37
|
+
return value !== undefined
|
|
38
|
+
&& value !== null;
|
|
39
|
+
}
|
|
40
|
+
constructor() {
|
|
41
|
+
super('become present', async (actor, actual) => {
|
|
42
|
+
const value = await IsPresent.valueToCheck(actual, actor);
|
|
43
|
+
const result = await IsPresent.isPresent(value, actor);
|
|
44
|
+
return result
|
|
45
|
+
? new core_1.ExpectationMet('become present', undefined, undefined)
|
|
46
|
+
: new core_1.ExpectationNotMet('become present', undefined, undefined);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=isPresent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/expectations/isPresent.ts"],"names":[],"mappings":";;;AAAA,4CAA2H;AAE3H;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS;IACrB,OAAO,IAAI,SAAS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sources":["../../src/expectations/isTrue.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,qCAAkC;AAElC,SAAgB,MAAM;IAClB,OAAO,kBAAW,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"isTrue.js","sourceRoot":"","sources":["../../src/expectations/isTrue.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,qCAAkC;AAElC,SAAgB,MAAM;IAClB,OAAO,kBAAW,CAAC,EAAE,CAAiB,YAAY,CAAC,CAAC,YAAY,CAAC,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC,CAAC;AACnF,CAAC;AAFD,wBAEC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Answerable, Expectation } from '@serenity-js/core';
|
|
2
|
-
export declare function matches(expected: Answerable<RegExp>): Expectation<
|
|
2
|
+
export declare function matches(expected: Answerable<RegExp>): Expectation<string>;
|