@serenity-js/assertions 2.32.7 → 3.0.0-rc.10

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +208 -2
  2. package/lib/Ensure.d.ts +1 -1
  3. package/lib/Ensure.js +7 -10
  4. package/lib/Ensure.js.map +1 -1
  5. package/lib/expectations/and.d.ts +1 -1
  6. package/lib/expectations/and.js +6 -6
  7. package/lib/expectations/and.js.map +1 -1
  8. package/lib/expectations/contain.d.ts +1 -1
  9. package/lib/expectations/containAtLeastOneItemThat.d.ts +1 -1
  10. package/lib/expectations/containAtLeastOneItemThat.js +16 -9
  11. package/lib/expectations/containAtLeastOneItemThat.js.map +1 -1
  12. package/lib/expectations/containItemsWhereEachItem.d.ts +1 -1
  13. package/lib/expectations/containItemsWhereEachItem.js +16 -9
  14. package/lib/expectations/containItemsWhereEachItem.js.map +1 -1
  15. package/lib/expectations/index.d.ts +1 -1
  16. package/lib/expectations/index.js +1 -1
  17. package/lib/expectations/index.js.map +1 -1
  18. package/lib/expectations/isFalse.js.map +1 -1
  19. package/lib/expectations/isPresent.d.ts +14 -0
  20. package/lib/expectations/isPresent.js +50 -0
  21. package/lib/expectations/isPresent.js.map +1 -0
  22. package/lib/expectations/isTrue.js.map +1 -1
  23. package/lib/expectations/matches.d.ts +1 -1
  24. package/lib/expectations/not.d.ts +1 -1
  25. package/lib/expectations/not.js +7 -8
  26. package/lib/expectations/not.js.map +1 -1
  27. package/lib/expectations/or.d.ts +1 -1
  28. package/lib/expectations/or.js +17 -12
  29. package/lib/expectations/or.js.map +1 -1
  30. package/package.json +8 -8
  31. package/src/Ensure.ts +17 -21
  32. package/src/expectations/and.ts +19 -18
  33. package/src/expectations/contain.ts +1 -1
  34. package/src/expectations/containAtLeastOneItemThat.ts +38 -14
  35. package/src/expectations/containItemsWhereEachItem.ts +38 -14
  36. package/src/expectations/index.ts +1 -1
  37. package/src/expectations/isFalse.ts +1 -1
  38. package/src/expectations/isPresent.ts +58 -0
  39. package/src/expectations/isTrue.ts +1 -1
  40. package/src/expectations/matches.ts +1 -1
  41. package/src/expectations/not.ts +15 -15
  42. package/src/expectations/or.ts +28 -25
  43. package/lib/expectations/property.d.ts +0 -2
  44. package/lib/expectations/property.js +0 -28
  45. package/lib/expectations/property.js.map +0 -1
  46. package/src/expectations/property.ts +0 -33
@@ -1,33 +0,0 @@
1
- import { AnswersQuestions, Expectation, ExpectationMet, ExpectationNotMet, ExpectationOutcome } from '@serenity-js/core';
2
- import { formatted } from '@serenity-js/core/lib/io';
3
-
4
- export function property<Actual, Property extends keyof Actual>(
5
- propertyName: Property,
6
- expectation: Expectation<any, Actual[Property]>,
7
- ): Expectation<Actual[Property], Actual> {
8
- return new HasProperty(propertyName, expectation);
9
- }
10
-
11
- /**
12
- * @package
13
- */
14
- class HasProperty<Property extends keyof Actual, Actual> extends Expectation<Actual[Property], Actual> {
15
- constructor(
16
- private readonly propertyName: Property,
17
- private readonly expectation: Expectation<any, Actual[Property]>,
18
- ) {
19
- super(formatted `have property ${ propertyName } that does ${ expectation }`);
20
- }
21
-
22
- answeredBy(actor: AnswersQuestions): (actual: Actual) => Promise<ExpectationOutcome<Actual[Property], any>> {
23
-
24
- return (actual: Actual) =>
25
- this.expectation.answeredBy(actor)(actual[this.propertyName])
26
- .then((outcome: ExpectationOutcome<any, Actual[Property]>) => {
27
-
28
- return outcome instanceof ExpectationMet
29
- ? new ExpectationMet(this.toString(), outcome.expected, actual[this.propertyName])
30
- : new ExpectationNotMet(this.toString(), outcome.expected, actual[this.propertyName]);
31
- });
32
- }
33
- }