@plugjs/expect5 0.4.2 → 0.4.4

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 (59) hide show
  1. package/dist/cli.mjs +1 -1
  2. package/dist/expectation/async.cjs +73 -0
  3. package/dist/expectation/async.cjs.map +6 -0
  4. package/dist/expectation/async.d.ts +54 -0
  5. package/dist/expectation/async.mjs +46 -0
  6. package/dist/expectation/async.mjs.map +6 -0
  7. package/dist/expectation/basic.cjs +155 -183
  8. package/dist/expectation/basic.cjs.map +1 -1
  9. package/dist/expectation/basic.d.ts +90 -47
  10. package/dist/expectation/basic.mjs +142 -163
  11. package/dist/expectation/basic.mjs.map +1 -1
  12. package/dist/expectation/diff.cjs +7 -7
  13. package/dist/expectation/diff.cjs.map +1 -1
  14. package/dist/expectation/diff.mjs +7 -7
  15. package/dist/expectation/diff.mjs.map +1 -1
  16. package/dist/expectation/expect.cjs +94 -108
  17. package/dist/expectation/expect.cjs.map +2 -2
  18. package/dist/expectation/expect.d.ts +103 -130
  19. package/dist/expectation/expect.mjs +131 -137
  20. package/dist/expectation/expect.mjs.map +2 -2
  21. package/dist/expectation/include.cjs +50 -61
  22. package/dist/expectation/include.cjs.map +1 -1
  23. package/dist/expectation/include.d.ts +19 -10
  24. package/dist/expectation/include.mjs +53 -57
  25. package/dist/expectation/include.mjs.map +1 -1
  26. package/dist/expectation/throwing.cjs +27 -27
  27. package/dist/expectation/throwing.cjs.map +1 -1
  28. package/dist/expectation/throwing.d.ts +36 -8
  29. package/dist/expectation/throwing.mjs +26 -26
  30. package/dist/expectation/throwing.mjs.map +1 -1
  31. package/dist/expectation/trivial.cjs +96 -0
  32. package/dist/expectation/trivial.cjs.map +6 -0
  33. package/dist/expectation/trivial.d.ts +13 -0
  34. package/dist/expectation/trivial.mjs +61 -0
  35. package/dist/expectation/trivial.mjs.map +6 -0
  36. package/dist/expectation/types.cjs +9 -12
  37. package/dist/expectation/types.cjs.map +1 -1
  38. package/dist/expectation/types.d.ts +52 -10
  39. package/dist/expectation/types.mjs +8 -10
  40. package/dist/expectation/types.mjs.map +1 -1
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.ts +1 -0
  43. package/dist/index.mjs.map +1 -1
  44. package/package.json +2 -2
  45. package/src/expectation/async.ts +151 -0
  46. package/src/expectation/basic.ts +360 -156
  47. package/src/expectation/diff.ts +8 -9
  48. package/src/expectation/expect.ts +239 -268
  49. package/src/expectation/include.ts +93 -59
  50. package/src/expectation/throwing.ts +102 -41
  51. package/src/expectation/trivial.ts +107 -0
  52. package/src/expectation/types.ts +82 -25
  53. package/src/index.ts +2 -0
  54. package/dist/expectation/void.cjs +0 -111
  55. package/dist/expectation/void.cjs.map +0 -6
  56. package/dist/expectation/void.d.ts +0 -39
  57. package/dist/expectation/void.mjs +0 -77
  58. package/dist/expectation/void.mjs.map +0 -6
  59. package/src/expectation/void.ts +0 -80
package/dist/cli.mjs CHANGED
@@ -8,7 +8,7 @@ var { $blu, $und, $gry, $wht } = logging;
8
8
  var $gnd = (s) => $gry($und(s));
9
9
  var $bnd = (s) => $blu($und(s));
10
10
  var $wnd = (s) => $wht($und(s));
11
- var version = true ? "0.4.2" : "0.0.0-dev";
11
+ var version = true ? "0.4.4" : "0.0.0-dev";
12
12
  function help() {
13
13
  console.log(`${$blu($und("Usage:"))}
14
14
 
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // expectation/async.ts
21
+ var async_exports = {};
22
+ __export(async_exports, {
23
+ toBeRejected: () => toBeRejected,
24
+ toBeRejectedWithError: () => toBeRejectedWithError,
25
+ toBeResolved: () => toBeResolved
26
+ });
27
+ module.exports = __toCommonJS(async_exports);
28
+ var import_types = require("./types.cjs");
29
+ function toBeResolved(assert) {
30
+ return Promise.resolve().then(() => {
31
+ this.expects.toHaveProperty("then", (a) => a.toBeA("function"));
32
+ return Promise.allSettled([Promise.resolve(this.value)]);
33
+ }).then(([settlement]) => {
34
+ if (settlement.status === "fulfilled") {
35
+ if (this.negative)
36
+ throw new import_types.ExpectationError(this, "to be resolved");
37
+ if (assert)
38
+ assert(this.forValue(settlement.value));
39
+ } else if (!this.negative) {
40
+ throw new import_types.ExpectationError(this, "to be resolved");
41
+ }
42
+ return this.expects;
43
+ });
44
+ }
45
+ function toBeRejected(assert) {
46
+ return Promise.resolve().then(() => {
47
+ this.expects.toHaveProperty("then", (a) => a.toBeA("function"));
48
+ return Promise.allSettled([Promise.resolve(this.value)]);
49
+ }).then(([settlement]) => {
50
+ if (settlement.status === "rejected") {
51
+ if (this.negative)
52
+ throw new import_types.ExpectationError(this, "to be rejected");
53
+ if (assert)
54
+ assert(this.forValue(settlement.reason));
55
+ } else if (!this.negative) {
56
+ throw new import_types.ExpectationError(this, "to be rejected");
57
+ }
58
+ return this.expects;
59
+ });
60
+ }
61
+ function toBeRejectedWithError(...args) {
62
+ return this.negated.toBeRejected((assert) => (
63
+ // @ts-ignore // can't reconcile the types with overloads...
64
+ assert.toBeError(...args)
65
+ ));
66
+ }
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ toBeRejected,
70
+ toBeRejectedWithError,
71
+ toBeResolved
72
+ });
73
+ //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AAK;AAAA,EACd,CAAC;AACP;AAsCA,SAAS,yBAEF,MAOkB;AACvB,SAAO,KAAK,QAAQ,aAAa,CAAC;AAAA;AAAA,IAEhC,OAAO,UAAU,GAAG,IAAI;AAAA,GAAC;AAC7B;",
5
+ "names": []
6
+ }
@@ -0,0 +1,54 @@
1
+ import type { Expectations } from './expect';
2
+ import type { AssertedType, AssertionFunction, Constructor } from './types';
3
+ /**
4
+ * A {@link Promise} for an {@link Expectations} instance expecting a
5
+ * _then-able_ {@link PromiseLike}.
6
+ *
7
+ * Long story short: the {@link toBeResolved}, {@link toBeRejectedWithError} and
8
+ * {@link toBeRejected} expectations are asynchronous, henceforth they return
9
+ * the first {@link Promise} to an {@link Expectations} instance. They also
10
+ * ensure that the value being expected is a _then-able_ {@link PromiseLike}.
11
+ */
12
+ type ExpectationsPromise<E, T2 = unknown> = unknown extends T2 ? E extends Expectations<infer T1> ? Promise<Expectations<PromiseLike<Awaited<T1>>>> : Promise<Expectations<PromiseLike<unknown>>> : Promise<Expectations<PromiseLike<T2>>>;
13
+ /** Expects the value to be a _resolved_ {@link PromiseLike}. */
14
+ declare function toBeResolved<T>(this: T): ExpectationsPromise<T>;
15
+ /**
16
+ * Expects the value to be a _resolved_ {@link Promise}, and asserts the
17
+ * resolved result with the specified callback.
18
+ */
19
+ declare function toBeResolved<T, A extends AssertionFunction>(this: T, assert: A): ExpectationsPromise<T, AssertedType<A>>;
20
+ /** Expect the value to be a _rejected_ {@link Promise}. */
21
+ declare function toBeRejected<T>(this: T): ExpectationsPromise<T>;
22
+ /**
23
+ * Expect the value to be a _rejected_ {@link Promise}, and asserts the
24
+ * rejection reason with the specified callback.
25
+ */
26
+ declare function toBeRejected<T>(this: T, assert: AssertionFunction): ExpectationsPromise<T>;
27
+ /** Expect the value to be a {@link Promise} _rejected_ by an {@link Error}. */
28
+ declare function toBeRejectedWithError<T>(this: T): ExpectationsPromise<T>;
29
+ /**
30
+ * Expect the value to be a {@link Promise} _rejected_ by an {@link Error}
31
+ * with the specified _message_.
32
+ */
33
+ declare function toBeRejectedWithError<T>(this: T, message: string): ExpectationsPromise<T>;
34
+ /**
35
+ * Expect the value to be a {@link Promise} _rejected_ by an {@link Error}
36
+ * with its _message_ matching the specified {@link RegExp}.
37
+ */
38
+ declare function toBeRejectedWithError<T>(this: T, message: RegExp): ExpectationsPromise<T>;
39
+ /**
40
+ * Expect the value to be a {@link Promise} _rejected_ by an {@link Error}
41
+ * of the specified _type_.
42
+ */
43
+ declare function toBeRejectedWithError<T>(this: T, constructor: Constructor<Error>): ExpectationsPromise<T>;
44
+ /**
45
+ * Expect the value to be a {@link Promise} _rejected_ by an {@link Error}
46
+ * of the specified _type_ and with the specified _message_.
47
+ */
48
+ declare function toBeRejectedWithError<T>(this: T, constructor: Constructor<Error>, message: string): ExpectationsPromise<T>;
49
+ /**
50
+ * Expect the value to be a {@link Promise} _rejected_ by an {@link Error}
51
+ * of the specified _type_ and with the specified _message_.
52
+ */
53
+ declare function toBeRejectedWithError<T>(this: T, constructor: Constructor<Error>, message: RegExp): ExpectationsPromise<T>;
54
+ export { toBeResolved, toBeRejected, toBeRejectedWithError };
@@ -0,0 +1,46 @@
1
+ // expectation/async.ts
2
+ import { ExpectationError } from "./types.mjs";
3
+ function toBeResolved(assert) {
4
+ return Promise.resolve().then(() => {
5
+ this.expects.toHaveProperty("then", (a) => a.toBeA("function"));
6
+ return Promise.allSettled([Promise.resolve(this.value)]);
7
+ }).then(([settlement]) => {
8
+ if (settlement.status === "fulfilled") {
9
+ if (this.negative)
10
+ throw new ExpectationError(this, "to be resolved");
11
+ if (assert)
12
+ assert(this.forValue(settlement.value));
13
+ } else if (!this.negative) {
14
+ throw new ExpectationError(this, "to be resolved");
15
+ }
16
+ return this.expects;
17
+ });
18
+ }
19
+ function toBeRejected(assert) {
20
+ return Promise.resolve().then(() => {
21
+ this.expects.toHaveProperty("then", (a) => a.toBeA("function"));
22
+ return Promise.allSettled([Promise.resolve(this.value)]);
23
+ }).then(([settlement]) => {
24
+ if (settlement.status === "rejected") {
25
+ if (this.negative)
26
+ throw new ExpectationError(this, "to be rejected");
27
+ if (assert)
28
+ assert(this.forValue(settlement.reason));
29
+ } else if (!this.negative) {
30
+ throw new ExpectationError(this, "to be rejected");
31
+ }
32
+ return this.expects;
33
+ });
34
+ }
35
+ function toBeRejectedWithError(...args) {
36
+ return this.negated.toBeRejected((assert) => (
37
+ // @ts-ignore // can't reconcile the types with overloads...
38
+ assert.toBeError(...args)
39
+ ));
40
+ }
41
+ export {
42
+ toBeRejected,
43
+ toBeRejectedWithError,
44
+ toBeResolved
45
+ };
46
+ //# sourceMappingURL=async.mjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/expectation/async.ts"],
4
+ "mappings": ";AAAA,SAAS,wBAAwB;AAyCjC,SAAS,aAEL,QACqB;AAEvB,SAAO,QAAQ,QAAQ,EAClB,KAAK,MAAM;AACV,SAAK,QAAQ,eAAe,QAAQ,CAAC,MAAM,EAAE,MAAM,UAAU,CAAC;AAC9D,WAAO,QAAQ,WAAW,CAAE,QAAQ,QAAQ,KAAK,KAAK,CAAE,CAAC;AAAA,EAC3D,CAAC,EACA,KAAK,CAAC,CAAE,UAAW,MAAM;AACxB,QAAI,WAAW,WAAW,aAAa;AACrC,UAAI,KAAK;AAAU,cAAM,IAAI,iBAAiB,MAAM,gBAAgB;AACpE,UAAI;AAAQ,eAAO,KAAK,SAAS,WAAW,KAAK,CAAC;AAAA,IACpD,WAAW,CAAE,KAAK,UAAU;AAC1B,YAAM,IAAI,iBAAiB,MAAM,gBAAgB;AAAA,IACnD;AAEA,WAAO,KAAK;AAAA,EACd,CAAC;AACP;AAcA,SAAS,aAEL,QACqB;AACvB,SAAO,QAAQ,QAAQ,EAClB,KAAK,MAAM;AACV,SAAK,QAAQ,eAAe,QAAQ,CAAC,MAAM,EAAE,MAAM,UAAU,CAAC;AAC9D,WAAO,QAAQ,WAAW,CAAE,QAAQ,QAAQ,KAAK,KAAK,CAAE,CAAC;AAAA,EAC3D,CAAC,EACA,KAAK,CAAC,CAAE,UAAW,MAAM;AACxB,QAAI,WAAW,WAAW,YAAY;AACpC,UAAI,KAAK;AAAU,cAAM,IAAI,iBAAiB,MAAM,gBAAgB;AACpE,UAAI;AAAQ,eAAO,KAAK,SAAS,WAAW,MAAM,CAAC;AAAA,IACrD,WAAW,CAAE,KAAK,UAAU;AAC1B,YAAM,IAAI,iBAAiB,MAAM,gBAAgB;AAAA,IACnD;AAEA,WAAO,KAAK;AAAA,EACd,CAAC;AACP;AAsCA,SAAS,yBAEF,MAOkB;AACvB,SAAO,KAAK,QAAQ,aAAa,CAAC;AAAA;AAAA,IAEhC,OAAO,UAAU,GAAG,IAAI;AAAA,GAAC;AAC7B;",
5
+ "names": []
6
+ }
@@ -20,197 +20,169 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // expectation/basic.ts
21
21
  var basic_exports = {};
22
22
  __export(basic_exports, {
23
- ToBeA: () => ToBeA,
24
- ToBeCloseTo: () => ToBeCloseTo,
25
- ToBeError: () => ToBeError,
26
- ToBeGreaterThan: () => ToBeGreaterThan,
27
- ToBeGreaterThanOrEqual: () => ToBeGreaterThanOrEqual,
28
- ToBeInstanceOf: () => ToBeInstanceOf,
29
- ToBeLessThan: () => ToBeLessThan,
30
- ToBeLessThanOrEqual: () => ToBeLessThanOrEqual,
31
- ToBeWithinRange: () => ToBeWithinRange,
32
- ToEqual: () => ToEqual,
33
- ToHaveLength: () => ToHaveLength,
34
- ToHaveProperty: () => ToHaveProperty,
35
- ToHaveSize: () => ToHaveSize,
36
- ToMatch: () => ToMatch,
37
- ToStrictlyEqual: () => ToStrictlyEqual
23
+ toBeA: () => toBeA,
24
+ toBeCloseTo: () => toBeCloseTo,
25
+ toBeError: () => toBeError,
26
+ toBeGreaterThan: () => toBeGreaterThan,
27
+ toBeGreaterThanOrEqual: () => toBeGreaterThanOrEqual,
28
+ toBeInstanceOf: () => toBeInstanceOf,
29
+ toBeLessThan: () => toBeLessThan,
30
+ toBeLessThanOrEqual: () => toBeLessThanOrEqual,
31
+ toBeWithinRange: () => toBeWithinRange,
32
+ toEqual: () => toEqual,
33
+ toHaveLength: () => toHaveLength,
34
+ toHaveProperty: () => toHaveProperty,
35
+ toHaveSize: () => toHaveSize,
36
+ toMatch: () => toMatch,
37
+ toStrictlyEqual: () => toStrictlyEqual
38
38
  });
39
39
  module.exports = __toCommonJS(basic_exports);
40
40
  var import_diff = require("./diff.cjs");
41
41
  var import_types = require("./types.cjs");
42
- var ToBeA = class {
43
- expect(context, negative, type) {
44
- const match = (0, import_types.isType)(context, type);
45
- if (match !== negative)
46
- return;
47
- throw new import_types.ExpectationError(context, negative, `to be ${(0, import_types.prefixType)(type)}`);
48
- }
49
- };
50
- var ToBeCloseTo = class {
51
- expect(context, negative, ...[value, delta]) {
52
- const min = value - delta;
53
- const max = value + delta;
54
- context.negated(negative).toBeWithinRange(min, max);
55
- }
56
- };
57
- var ToBeError = class {
58
- expect(context, negative, ...args) {
59
- const [constructor, message] = typeof args[0] === "function" ? [args[0], args[1]] : [Error, args[0]];
60
- context.negated(negative).toBeInstanceOf(constructor);
61
- if (negative || message === void 0)
62
- return;
63
- context.toHaveProperty("message", (assert) => {
64
- (0, import_types.assertType)(assert, "string");
65
- if (typeof message === "string")
66
- assert.toStrictlyEqual(message);
67
- else
68
- assert.toMatch(message);
69
- });
70
- }
71
- };
72
- var ToBeGreaterThan = class {
73
- expect(context, negative, value) {
74
- (0, import_types.assertType)(context, typeof value);
75
- if (context.value > value !== negative)
76
- return;
77
- throw new import_types.ExpectationError(context, negative, `to be greater than ${(0, import_types.stringifyValue)(value)}`);
78
- }
79
- };
80
- var ToBeGreaterThanOrEqual = class {
81
- expect(context, negative, value) {
82
- (0, import_types.assertType)(context, typeof value);
83
- if (context.value >= value !== negative)
84
- return;
85
- throw new import_types.ExpectationError(context, negative, `to be greater than or equal to ${(0, import_types.stringifyValue)(value)}`);
86
- }
87
- };
88
- var ToBeInstanceOf = class {
89
- expect(context, negative, value) {
90
- const match = context.value instanceof value;
91
- if (match !== negative)
92
- return;
93
- throw new import_types.ExpectationError(context, negative, `to be an instance of ${(0, import_types.stringifyConstructor)(value)}`);
94
- }
95
- };
96
- var ToBeLessThan = class {
97
- expect(context, negative, value) {
98
- (0, import_types.assertType)(context, typeof value);
99
- if (context.value < value !== negative)
100
- return;
101
- throw new import_types.ExpectationError(context, negative, `to be less than ${(0, import_types.stringifyValue)(value)}`);
102
- }
103
- };
104
- var ToBeLessThanOrEqual = class {
105
- expect(context, negative, value) {
106
- (0, import_types.assertType)(context, typeof value);
107
- if (context.value <= value !== negative)
108
- return;
109
- throw new import_types.ExpectationError(context, negative, `to be less than or equal to ${(0, import_types.stringifyValue)(value)}`);
110
- }
111
- };
112
- var ToBeWithinRange = class {
113
- expect(context, negative, ...[min, max]) {
114
- if (max < min) {
115
- const num = max;
116
- max = min;
117
- min = num;
118
- }
119
- (0, import_types.assertType)(context, typeof min);
120
- if ((context.value >= min && context.value <= max) !== negative)
121
- return;
122
- throw new import_types.ExpectationError(context, negative, `to be within ${(0, import_types.stringifyValue)(min)}...${(0, import_types.stringifyValue)(max)}`);
123
- }
124
- };
125
- var ToEqual = class {
126
- expect(context, negative, expected) {
127
- const result = (0, import_diff.diff)(context.value, expected);
128
- if (result.diff === negative)
129
- return;
130
- throw new import_types.ExpectationError(context, negative, `to equal ${(0, import_types.stringifyValue)(expected)}`, result);
131
- }
132
- };
133
- var ToHaveLength = class {
134
- expect(context, negative, length) {
135
- context.toBeDefined();
136
- const actualLength = context.value.length;
137
- if (typeof actualLength !== "number") {
138
- throw new import_types.ExpectationError(context, false, 'to have a numeric "length" property');
139
- }
140
- if (actualLength === length === negative) {
141
- throw new import_types.ExpectationError(context, negative, `to have length ${(0, import_types.stringifyValue)(length)}`);
142
- }
143
- }
144
- };
145
- var ToHaveProperty = class {
146
- expect(context, negative, prop, assert) {
147
- context.toBeDefined();
148
- const match = context.value[prop] !== void 0;
149
- if (match === negative) {
150
- throw new import_types.ExpectationError(context, negative, `to have property "${String(prop)}"`);
151
- } else if (match && assert) {
152
- try {
153
- assert(context.forProperty(prop));
154
- } catch (error) {
155
- if (error instanceof import_types.ExpectationError && error.diff) {
156
- error.diff = {
157
- diff: true,
158
- value: context.value,
159
- props: { [prop]: error.diff }
160
- };
161
- }
162
- throw error;
42
+ function toBeA(type, assert) {
43
+ const match = (0, import_types.typeOf)(this.value) === type;
44
+ if (match === this.negative) {
45
+ throw new import_types.ExpectationError(this, `to be ${(0, import_types.prefixType)(type)}`);
46
+ } else if (assert) {
47
+ assert(this.expects);
48
+ }
49
+ return this.expects;
50
+ }
51
+ function toBeCloseTo(value, delta) {
52
+ const min = value - delta;
53
+ const max = value + delta;
54
+ return this.negated.toBeWithinRange(min, max);
55
+ }
56
+ function toBeError(...args) {
57
+ const [constructor, message] = typeof args[0] === "function" ? [args[0], args[1]] : [Error, args[0]];
58
+ this.negated.toBeInstanceOf(constructor);
59
+ if (this.negative || message === void 0)
60
+ return this.expects;
61
+ return this.expects.toHaveProperty("message", (assert) => {
62
+ assert.toBeA("string");
63
+ return typeof message === "string" ? assert.toStrictlyEqual(message) : assert.toMatch(message);
64
+ });
65
+ }
66
+ function toBeGreaterThan(value) {
67
+ (0, import_types.assertContextType)(this, typeof value);
68
+ if (this.value > value !== this.negative)
69
+ return this.expects;
70
+ throw new import_types.ExpectationError(this, `to be greater than ${(0, import_types.stringifyValue)(value)}`);
71
+ }
72
+ function toBeGreaterThanOrEqual(value) {
73
+ (0, import_types.assertContextType)(this, typeof value);
74
+ if (this.value >= value !== this.negative)
75
+ return this.expects;
76
+ throw new import_types.ExpectationError(this, `to be greater than or equal to ${(0, import_types.stringifyValue)(value)}`);
77
+ }
78
+ function toBeInstanceOf(value) {
79
+ const match = this.value instanceof value;
80
+ if (match !== this.negative)
81
+ return this.expects;
82
+ throw new import_types.ExpectationError(this, `to be an instance of ${(0, import_types.stringifyConstructor)(value)}`);
83
+ }
84
+ function toBeLessThan(value) {
85
+ (0, import_types.assertContextType)(this, typeof value);
86
+ if (this.value < value !== this.negative)
87
+ return this.expects;
88
+ throw new import_types.ExpectationError(this, `to be less than ${(0, import_types.stringifyValue)(value)}`);
89
+ }
90
+ function toBeLessThanOrEqual(value) {
91
+ (0, import_types.assertContextType)(this, typeof value);
92
+ if (this.value <= value !== this.negative)
93
+ return this.expects;
94
+ throw new import_types.ExpectationError(this, `to be less than or equal to ${(0, import_types.stringifyValue)(value)}`);
95
+ }
96
+ function toBeWithinRange(min, max) {
97
+ if (max < min) {
98
+ const num = max;
99
+ max = min;
100
+ min = num;
101
+ }
102
+ (0, import_types.assertContextType)(this, typeof min);
103
+ if ((this.value >= min && this.value <= max) !== this.negative)
104
+ return this.expects;
105
+ throw new import_types.ExpectationError(this, `to be within ${(0, import_types.stringifyValue)(min)}...${(0, import_types.stringifyValue)(max)}`);
106
+ }
107
+ function toEqual(expected) {
108
+ const result = (0, import_diff.diff)(this.value, expected);
109
+ if (result.diff === this.negative)
110
+ return this.expects;
111
+ throw new import_types.ExpectationError(this, `to equal ${(0, import_types.stringifyValue)(expected)}`, result);
112
+ }
113
+ function toHaveLength(length) {
114
+ this.expects.toBeDefined();
115
+ const actualLength = this.value.length;
116
+ if (typeof actualLength !== "number") {
117
+ throw new import_types.ExpectationError(this, 'to have a numeric "length" property', false);
118
+ }
119
+ if (actualLength === length === this.negative) {
120
+ throw new import_types.ExpectationError(this, `to have length ${(0, import_types.stringifyValue)(length)}`);
121
+ }
122
+ return this.expects;
123
+ }
124
+ function toHaveProperty(prop, assert) {
125
+ this.expects.toBeDefined();
126
+ const match = this.value[prop] !== void 0;
127
+ if (match === this.negative) {
128
+ throw new import_types.ExpectationError(this, `to have property "${String(prop)}"`);
129
+ } else if (match && assert) {
130
+ try {
131
+ assert(this.forProperty(prop));
132
+ } catch (error) {
133
+ if (error instanceof import_types.ExpectationError && error.diff) {
134
+ error.diff = {
135
+ diff: true,
136
+ value: this.value,
137
+ props: { [prop]: error.diff }
138
+ };
163
139
  }
140
+ throw error;
164
141
  }
165
142
  }
166
- };
167
- var ToHaveSize = class {
168
- expect(context, negative, size) {
169
- context.toBeDefined();
170
- const actualSize = context.value.size;
171
- if (typeof actualSize !== "number") {
172
- throw new import_types.ExpectationError(context, false, 'to have a numeric "size" property');
173
- }
174
- if (actualSize === size === negative) {
175
- throw new import_types.ExpectationError(context, negative, `to have size ${(0, import_types.stringifyValue)(size)}`);
176
- }
177
- }
178
- };
179
- var ToMatch = class {
180
- expect(context, negative, expr) {
181
- (0, import_types.assertType)(context, "string");
182
- const match = !!context.value.match(expr);
183
- if (match !== negative)
184
- return;
185
- throw new import_types.ExpectationError(context, negative, `to match ${(0, import_types.stringifyValue)(expr)}`);
186
- }
187
- };
188
- var ToStrictlyEqual = class {
189
- expect(context, negative, expected) {
190
- const value = context.value;
191
- const match = value === expected;
192
- if (match !== negative)
193
- return;
194
- const diff2 = negative ? void 0 : { diff: true, value, expected };
195
- throw new import_types.ExpectationError(context, negative, `to strictly equal ${(0, import_types.stringifyValue)(expected)}`, diff2);
196
- }
197
- };
143
+ return this.expects;
144
+ }
145
+ function toHaveSize(size) {
146
+ this.expects.toBeDefined();
147
+ const actualSize = this.value.size;
148
+ if (typeof actualSize !== "number") {
149
+ throw new import_types.ExpectationError(this, 'to have a numeric "size" property', false);
150
+ }
151
+ if (actualSize === size === this.negative) {
152
+ throw new import_types.ExpectationError(this, `to have size ${(0, import_types.stringifyValue)(size)}`);
153
+ }
154
+ return this.expects;
155
+ }
156
+ function toMatch(expr) {
157
+ (0, import_types.assertContextType)(this, "string");
158
+ const match = !!this.value.match(expr);
159
+ if (match !== this.negative)
160
+ return this.expects;
161
+ throw new import_types.ExpectationError(this, `to match ${(0, import_types.stringifyValue)(expr)}`);
162
+ }
163
+ function toStrictlyEqual(expected) {
164
+ const match = this.value === expected;
165
+ if (match !== this.negative)
166
+ return this.expects;
167
+ const diff2 = this.negative ? void 0 : { diff: true, value: this.value, expected };
168
+ throw new import_types.ExpectationError(this, `to strictly equal ${(0, import_types.stringifyValue)(expected)}`, diff2);
169
+ }
198
170
  // Annotate the CommonJS export names for ESM import in node:
199
171
  0 && (module.exports = {
200
- ToBeA,
201
- ToBeCloseTo,
202
- ToBeError,
203
- ToBeGreaterThan,
204
- ToBeGreaterThanOrEqual,
205
- ToBeInstanceOf,
206
- ToBeLessThan,
207
- ToBeLessThanOrEqual,
208
- ToBeWithinRange,
209
- ToEqual,
210
- ToHaveLength,
211
- ToHaveProperty,
212
- ToHaveSize,
213
- ToMatch,
214
- ToStrictlyEqual
172
+ toBeA,
173
+ toBeCloseTo,
174
+ toBeError,
175
+ toBeGreaterThan,
176
+ toBeGreaterThanOrEqual,
177
+ toBeInstanceOf,
178
+ toBeLessThan,
179
+ toBeLessThanOrEqual,
180
+ toBeWithinRange,
181
+ toEqual,
182
+ toHaveLength,
183
+ toHaveProperty,
184
+ toHaveSize,
185
+ toMatch,
186
+ toStrictlyEqual
215
187
  });
216
188
  //# sourceMappingURL=basic.cjs.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/expectation/basic.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,mBAAuG;AAKhG,IAAM,QAAN,MAAmC;AAAA,EACxC,OAAO,SAAuB,UAAmB,MAAsB;AACrE,UAAM,YAAQ,qBAAO,SAAS,IAAI;AAClC,QAAI,UAAU;AAAU;AACxB,UAAM,IAAI,8BAAiB,SAAS,UAAU,aAAS,yBAAW,IAAI,GAAG;AAAA,EAC3E;AACF;AAEO,IAAM,cAAN,MAAyC;AAAA,EAC9C,OACI,SACA,aACG,CAAE,OAAO,KAAM,GAGd;AACN,UAAM,MAAO,QAAoB;AACj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