@augment-vir/assert 30.0.0 → 30.0.1
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/README.md +11 -0
- package/dist/assertions/boolean.d.ts +443 -17
- package/dist/assertions/boolean.js +365 -8
- package/dist/assertions/boundary.d.ts +657 -13
- package/dist/assertions/boundary.js +537 -5
- package/dist/assertions/enum.d.ts +236 -8
- package/dist/assertions/enum.js +197 -5
- package/dist/assertions/equality/entry-equality.d.ts +287 -11
- package/dist/assertions/equality/entry-equality.js +243 -6
- package/dist/assertions/equality/json-equality.d.ts +244 -15
- package/dist/assertions/equality/json-equality.js +207 -11
- package/dist/assertions/equality/simple-equality.d.ts +849 -28
- package/dist/assertions/equality/simple-equality.js +712 -6
- package/dist/assertions/equality/ts-type-equality.d.ts +37 -1
- package/dist/assertions/equality/ts-type-equality.js +13 -1
- package/dist/assertions/extendable-assertions.d.ts +288 -120
- package/dist/assertions/extendable-assertions.js +32 -60
- package/dist/assertions/http.d.ts +217 -10
- package/dist/assertions/http.js +182 -6
- package/dist/assertions/instance.d.ts +189 -8
- package/dist/assertions/instance.js +159 -5
- package/dist/assertions/keys.d.ts +658 -13
- package/dist/assertions/keys.js +556 -5
- package/dist/assertions/length.d.ts +381 -9
- package/dist/assertions/length.js +309 -5
- package/dist/assertions/nullish.d.ts +169 -7
- package/dist/assertions/nullish.js +137 -6
- package/dist/assertions/numeric.d.ts +965 -11
- package/dist/assertions/numeric.js +819 -1
- package/dist/assertions/output.d.ts +107 -7
- package/dist/assertions/output.js +92 -5
- package/dist/assertions/primitive.d.ts +416 -13
- package/dist/assertions/primitive.js +352 -6
- package/dist/assertions/promise.d.ts +640 -21
- package/dist/assertions/promise.js +536 -15
- package/dist/assertions/regexp.d.ts +202 -3
- package/dist/assertions/regexp.js +173 -1
- package/dist/assertions/runtime-type.d.ts +1822 -41
- package/dist/assertions/runtime-type.js +1558 -35
- package/dist/assertions/throws.d.ts +265 -17
- package/dist/assertions/throws.js +229 -17
- package/dist/assertions/uuid.d.ts +233 -10
- package/dist/assertions/uuid.js +195 -6
- package/dist/assertions/values.d.ts +1086 -15
- package/dist/assertions/values.js +907 -6
- package/dist/augments/assertion.error.d.ts +2 -1
- package/dist/augments/assertion.error.js +2 -1
- package/dist/augments/guards/assert-wrap.d.ts +82 -37
- package/dist/augments/guards/assert-wrap.js +13 -2
- package/dist/augments/guards/assert.d.ts +30 -14
- package/dist/augments/guards/assert.js +21 -4
- package/dist/augments/guards/check-wrap.d.ts +94 -51
- package/dist/augments/guards/check-wrap.js +11 -3
- package/dist/augments/guards/check.d.ts +87 -37
- package/dist/augments/guards/check.js +9 -2
- package/dist/augments/guards/wait-until.d.ts +110 -103
- package/dist/augments/guards/wait-until.js +18 -3
- package/dist/augments/if-equals.d.ts +4 -2
- package/dist/guard-types/assert-wrap-function.d.ts +5 -2
- package/dist/guard-types/check-function.d.ts +5 -2
- package/dist/guard-types/check-wrap-wrapper-function.d.ts +4 -1
- package/dist/guard-types/guard-group.d.ts +7 -8
- package/dist/guard-types/wait-until-function.d.ts +8 -3
- package/dist/guard-types/wait-until-function.js +1 -1
- package/package.json +17 -4
|
@@ -1,48 +1,27 @@
|
|
|
1
|
+
import { AnyFunction } from '@augment-vir/core';
|
|
1
2
|
import { WaitUntilOptions } from '../../guard-types/wait-until-function.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* return 123;
|
|
18
|
-
* } else {
|
|
19
|
-
* return '123';
|
|
20
|
-
* }
|
|
21
|
-
* },
|
|
22
|
-
* {
|
|
23
|
-
* interval: {milliseconds: 100},
|
|
24
|
-
* timeout: {seconds: 10},
|
|
25
|
-
* },
|
|
26
|
-
* );
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @returns The successful callback return value.
|
|
30
|
-
* @throws {@link AssertionError} When the assertion fails.
|
|
31
|
-
* @package @augment-vir/assert
|
|
32
|
-
*/
|
|
33
|
-
export declare const waitUntil: {
|
|
34
|
-
isTruthy: <Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("../assertion-exports.js").Truthy<Actual>>;
|
|
3
|
+
declare const waitUntilGroup: {
|
|
4
|
+
endsWith: {
|
|
5
|
+
<const ArrayElement>(child: ArrayElement, callback: () => import("@augment-vir/core").MaybePromise<ReadonlyArray<ArrayElement>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<ReadonlyArray<ArrayElement>>;
|
|
6
|
+
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string>;
|
|
7
|
+
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string | ReadonlyArray<string>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string | ReadonlyArray<string>>;
|
|
8
|
+
};
|
|
9
|
+
startsWith: {
|
|
10
|
+
<const ArrayElement>(child: ArrayElement, callback: () => import("@augment-vir/core").MaybePromise<ReadonlyArray<ArrayElement>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<ReadonlyArray<ArrayElement>>;
|
|
11
|
+
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string>;
|
|
12
|
+
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string | ReadonlyArray<string>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string | ReadonlyArray<string>>;
|
|
13
|
+
};
|
|
14
|
+
isFalse: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
15
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
16
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
17
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, false>>;
|
|
35
18
|
isFalsy: <Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("../assertion-exports.js").Falsy<Actual>>;
|
|
36
19
|
isTrue: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
37
20
|
interval: import("@date-vir/duration").AnyDuration;
|
|
38
21
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
39
22
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, true>>;
|
|
40
|
-
|
|
41
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
42
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
43
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, false>>;
|
|
23
|
+
isTruthy: <Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("../assertion-exports.js").Truthy<Actual>>;
|
|
44
24
|
strictEquals: <Actual, Expected extends Actual>(expected: Expected, callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Actual, Expected>>;
|
|
45
|
-
deepEquals: <Actual, Expected extends Actual>(expected: Expected, callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Actual, Expected>>;
|
|
46
25
|
notStrictEquals: <Input extends unknown>(expected: unknown, params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
47
26
|
interval: import("@date-vir/duration").AnyDuration;
|
|
48
27
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
@@ -55,30 +34,12 @@ export declare const waitUntil: {
|
|
|
55
34
|
interval: import("@date-vir/duration").AnyDuration;
|
|
56
35
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
57
36
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
37
|
+
deepEquals: <Actual, Expected extends Actual>(expected: Expected, callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Actual, Expected>>;
|
|
58
38
|
notDeepEquals: <Input extends unknown>(expected: unknown, params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
59
39
|
interval: import("@date-vir/duration").AnyDuration;
|
|
60
40
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
61
41
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
62
42
|
output: typeof import("../../assertions/output.js").waitUntilOutput;
|
|
63
|
-
isFunction: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToActual<Actual, import("@augment-vir/core").AnyFunction>>;
|
|
64
|
-
isNotArray: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, ReadonlyArray<unknown>>>;
|
|
65
|
-
isNotBigInt: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, bigint>>;
|
|
66
|
-
isNotBoolean: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, boolean>>;
|
|
67
|
-
isNotFunction: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("@augment-vir/core").AnyFunction>>;
|
|
68
|
-
isNotNull: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, null>>;
|
|
69
|
-
isNotNumber: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, number>>;
|
|
70
|
-
isNotObject: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("@augment-vir/core").UnknownObject>>;
|
|
71
|
-
isNotString: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, string>>;
|
|
72
|
-
isNotUndefined: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, undefined>>;
|
|
73
|
-
isNotSymbol: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, symbol>>;
|
|
74
|
-
isSymbol: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
75
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
76
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
77
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, symbol>>;
|
|
78
|
-
isUndefined: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
79
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
80
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
81
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, undefined>>;
|
|
82
43
|
isArray: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
83
44
|
interval: import("@date-vir/duration").AnyDuration;
|
|
84
45
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
@@ -91,6 +52,7 @@ export declare const waitUntil: {
|
|
|
91
52
|
interval: import("@date-vir/duration").AnyDuration;
|
|
92
53
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
93
54
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, boolean>>;
|
|
55
|
+
isFunction: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToActual<Actual, AnyFunction>>;
|
|
94
56
|
isNull: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
95
57
|
interval: import("@date-vir/duration").AnyDuration;
|
|
96
58
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
@@ -107,9 +69,27 @@ export declare const waitUntil: {
|
|
|
107
69
|
interval: import("@date-vir/duration").AnyDuration;
|
|
108
70
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
109
71
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, string>>;
|
|
72
|
+
isSymbol: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
73
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
74
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
75
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, symbol>>;
|
|
76
|
+
isUndefined: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
77
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
78
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
79
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, undefined>>;
|
|
80
|
+
isNotArray: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, ReadonlyArray<unknown>>>;
|
|
81
|
+
isNotBigInt: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, bigint>>;
|
|
82
|
+
isNotBoolean: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, boolean>>;
|
|
83
|
+
isNotFunction: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, AnyFunction>>;
|
|
84
|
+
isNotNull: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, null>>;
|
|
85
|
+
isNotNumber: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, number>>;
|
|
86
|
+
isNotObject: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("@augment-vir/core").UnknownObject>>;
|
|
87
|
+
isNotString: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, string>>;
|
|
88
|
+
isNotSymbol: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, symbol>>;
|
|
89
|
+
isNotUndefined: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, undefined>>;
|
|
110
90
|
throws: {
|
|
111
|
-
(
|
|
112
|
-
(matchOptions: import("../assertion-exports.js").ErrorMatchOptions,
|
|
91
|
+
(callback: import("@augment-vir/core").TypedFunction<void, any>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<Error>;
|
|
92
|
+
(matchOptions: import("../assertion-exports.js").ErrorMatchOptions, callback: import("@augment-vir/core").TypedFunction<void, any>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<Error>;
|
|
113
93
|
};
|
|
114
94
|
isError: <Input extends unknown>(matchOptions: import("@augment-vir/core").PartialWithNullable<{
|
|
115
95
|
matchMessage: string | RegExp;
|
|
@@ -118,12 +98,32 @@ export declare const waitUntil: {
|
|
|
118
98
|
interval: import("@date-vir/duration").AnyDuration;
|
|
119
99
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
120
100
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, Error>>;
|
|
121
|
-
|
|
101
|
+
hasValue: <Input extends object>(value: unknown, params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
102
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
103
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
104
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
105
|
+
lacksValue: <Input extends object>(value: unknown, params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
106
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
107
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
108
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
109
|
+
hasValues: <Input extends object>(values: readonly unknown[], params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
110
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
111
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
112
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
113
|
+
lacksValues: <Input extends object>(values: readonly unknown[], params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
114
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
115
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
116
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
117
|
+
isIn: <const Child, const Parent>(parent: Parent, callback: () => import("@augment-vir/core").MaybePromise<Child>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Child, import("@augment-vir/core").Values<Parent>>>;
|
|
118
|
+
isNotIn: <const Child, const Parent>(parent: Parent, callback: () => import("@augment-vir/core").MaybePromise<Child>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Child, import("@augment-vir/core").Values<Parent>>>;
|
|
119
|
+
isEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToActual<Actual, import("../assertion-exports.js").Empty>>;
|
|
120
|
+
isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("../assertion-exports.js").Empty>>;
|
|
121
|
+
endsWithout: {
|
|
122
122
|
<const ArrayElement>(child: ArrayElement, callback: () => import("@augment-vir/core").MaybePromise<ReadonlyArray<ArrayElement>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<ReadonlyArray<ArrayElement>>;
|
|
123
123
|
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string>;
|
|
124
124
|
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string | ReadonlyArray<string>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string | ReadonlyArray<string>>;
|
|
125
125
|
};
|
|
126
|
-
|
|
126
|
+
startsWithout: {
|
|
127
127
|
<const ArrayElement>(child: ArrayElement, callback: () => import("@augment-vir/core").MaybePromise<ReadonlyArray<ArrayElement>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<ReadonlyArray<ArrayElement>>;
|
|
128
128
|
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string>;
|
|
129
129
|
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string | ReadonlyArray<string>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string | ReadonlyArray<string>>;
|
|
@@ -140,18 +140,18 @@ export declare const waitUntil: {
|
|
|
140
140
|
interval: import("@date-vir/duration").AnyDuration;
|
|
141
141
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
142
142
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
143
|
-
isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(category: Category, callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>>>;
|
|
144
143
|
isHttpStatus: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
145
144
|
interval: import("@date-vir/duration").AnyDuration;
|
|
146
145
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
147
146
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, import("@augment-vir/core").HttpStatus>>;
|
|
147
|
+
isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(category: Category, callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>>>;
|
|
148
148
|
instanceOf: <const Instance>(constructor: import("type-fest").Constructor<Instance>, callback: () => import("@augment-vir/core").MaybePromise<unknown>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Instance>;
|
|
149
149
|
notInstanceOf: <const Actual, const Instance>(constructor: import("type-fest").Constructor<Instance>, callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, Instance>>;
|
|
150
150
|
isKeyOf: <const Key extends PropertyKey, const Parent>(parent: Parent, callback: () => import("@augment-vir/core").MaybePromise<Key>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Key, keyof Parent>>;
|
|
151
151
|
isNotKeyOf: <const Key extends PropertyKey, const Parent>(parent: Parent, callback: () => import("@augment-vir/core").MaybePromise<Key>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Key, import("@augment-vir/core").RequiredKeysOf<Parent>>>;
|
|
152
|
-
hasKey: <const Parent, const Key extends PropertyKey>(key: Key, callback: () => import("@augment-vir/core").MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent & Record<Key, (Key extends keyof Parent ? import("
|
|
152
|
+
hasKey: <const Parent, const Key extends PropertyKey>(key: Key, callback: () => import("@augment-vir/core").MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent & Record<Key, (Key extends keyof Parent ? import("@augment-vir/core").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("@augment-vir/core").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never) extends never ? unknown : Key extends keyof Parent ? import("@augment-vir/core").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("@augment-vir/core").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never>>;
|
|
153
153
|
lacksKey: <const Parent, const Key extends PropertyKey>(key: Key, callback: () => import("@augment-vir/core").MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Parent, Record<Key, any>>>;
|
|
154
|
-
hasKeys: <const Keys extends PropertyKey, const Parent>(keys: ReadonlyArray<Keys>, callback: () => import("@augment-vir/core").MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent & Record<Keys, (Keys extends keyof Parent ? import("
|
|
154
|
+
hasKeys: <const Keys extends PropertyKey, const Parent>(keys: ReadonlyArray<Keys>, callback: () => import("@augment-vir/core").MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent & Record<Keys, (Keys extends keyof Parent ? import("@augment-vir/core").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("@augment-vir/core").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never) extends never ? unknown : Keys extends keyof Parent ? import("@augment-vir/core").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("@augment-vir/core").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never>>;
|
|
155
155
|
lacksKeys: <const Parent, const Keys extends PropertyKey>(keys: ReadonlyArray<Keys>, callback: () => import("@augment-vir/core").MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Parent, Partial<Record<Keys, any>>>>;
|
|
156
156
|
isLengthAtLeast: {
|
|
157
157
|
<Element, Length extends number>(length: Length, callback: () => import("@augment-vir/core").MaybePromise<ReadonlyArray<Element | undefined>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<import("@augment-vir/core").AtLeastTuple<Element, Length>>;
|
|
@@ -202,45 +202,20 @@ export declare const waitUntil: {
|
|
|
202
202
|
interval: import("@date-vir/duration").AnyDuration;
|
|
203
203
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
204
204
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
205
|
-
isNotPrimitive: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("type-fest").Primitive>>;
|
|
206
|
-
isNotPropertyKey: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, PropertyKey>>;
|
|
207
205
|
isPropertyKey: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
208
206
|
interval: import("@date-vir/duration").AnyDuration;
|
|
209
207
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
210
208
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, PropertyKey>>;
|
|
209
|
+
isNotPropertyKey: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, PropertyKey>>;
|
|
211
210
|
isPrimitive: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
212
211
|
interval: import("@date-vir/duration").AnyDuration;
|
|
213
212
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
214
213
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, import("type-fest").Primitive>>;
|
|
215
|
-
|
|
214
|
+
isNotPrimitive: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("type-fest").Primitive>>;
|
|
215
|
+
isPromiseLike: <const Actual>(callback: () => Actual, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Extract<Actual, PromiseLike<any>>>;
|
|
216
216
|
isNotPromiseLike: <const Actual>(callback: () => Actual, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, PromiseLike<any>>>;
|
|
217
217
|
isPromise: <const Actual>(callback: () => Actual, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Extract<Actual, Promise<any>>>;
|
|
218
|
-
|
|
219
|
-
isNotUuid: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("@augment-vir/core").Uuid>>;
|
|
220
|
-
isUuid: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
221
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
222
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
223
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, `${string}-${string}-${string}-${string}-${string}`>>;
|
|
224
|
-
hasValue: <Input extends object>(value: unknown, params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
225
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
226
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
227
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
228
|
-
lacksValue: <Input extends object>(value: unknown, params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
229
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
230
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
231
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
232
|
-
hasValues: <Input extends object>(values: readonly unknown[], params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
233
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
234
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
235
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
236
|
-
lacksValues: <Input extends object>(values: readonly unknown[], params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
237
|
-
interval: import("@date-vir/duration").AnyDuration;
|
|
238
|
-
timeout: import("@date-vir/duration").AnyDuration;
|
|
239
|
-
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
240
|
-
isIn: <const Child, const Parent>(parent: Parent, callback: () => import("@augment-vir/core").MaybePromise<Child>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Child, import("@augment-vir/core").Values<Parent>>>;
|
|
241
|
-
isNotIn: <const Child, const Parent>(parent: Parent, callback: () => import("@augment-vir/core").MaybePromise<Child>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Child, import("@augment-vir/core").Values<Parent>>>;
|
|
242
|
-
isEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToActual<Actual, import("../assertion-exports.js").Empty>>;
|
|
243
|
-
isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("../assertion-exports.js").Empty>>;
|
|
218
|
+
isNotPromise: <const Actual>(callback: () => Actual, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, Promise<any>>>;
|
|
244
219
|
matches: <Input extends string>(expected: RegExp, params_1: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
245
220
|
interval: import("@date-vir/duration").AnyDuration;
|
|
246
221
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
@@ -249,14 +224,46 @@ export declare const waitUntil: {
|
|
|
249
224
|
interval: import("@date-vir/duration").AnyDuration;
|
|
250
225
|
timeout: import("@date-vir/duration").AnyDuration;
|
|
251
226
|
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, unknown>>;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
startsWithout: {
|
|
258
|
-
<const ArrayElement>(child: ArrayElement, callback: () => import("@augment-vir/core").MaybePromise<ReadonlyArray<ArrayElement>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<ReadonlyArray<ArrayElement>>;
|
|
259
|
-
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string>;
|
|
260
|
-
(child: string, callback: () => import("@augment-vir/core").MaybePromise<string | ReadonlyArray<string>>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined): Promise<string | ReadonlyArray<string>>;
|
|
261
|
-
};
|
|
227
|
+
isUuid: <Input extends unknown>(params_0: () => import("@augment-vir/core").MaybePromise<Input>, options?: import("@augment-vir/core").PartialWithUndefined<{
|
|
228
|
+
interval: import("@date-vir/duration").AnyDuration;
|
|
229
|
+
timeout: import("@date-vir/duration").AnyDuration;
|
|
230
|
+
}> | undefined, failureMessage?: string | undefined) => Promise<import("@augment-vir/core").NarrowToExpected<Input, `${string}-${string}-${string}-${string}-${string}`>>;
|
|
231
|
+
isNotUuid: <const Actual>(callback: () => import("@augment-vir/core").MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, import("@augment-vir/core").Uuid>>;
|
|
262
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* A group of guard methods that run the given callback multiple times until its return value
|
|
235
|
+
* matches expectations. Callback interval and timeout can be customized with
|
|
236
|
+
* {@link WaitUntilOptions}.
|
|
237
|
+
*
|
|
238
|
+
* This can also be called as a standalone wait until function which waits until the callback's
|
|
239
|
+
* returned value is truthy.
|
|
240
|
+
*
|
|
241
|
+
* @category Assert
|
|
242
|
+
* @category Package : @augment-vir/assert
|
|
243
|
+
* @example
|
|
244
|
+
*
|
|
245
|
+
* ```ts
|
|
246
|
+
* import {waitUntil} from '@augment-vir/assert';
|
|
247
|
+
*
|
|
248
|
+
* // `result` will eventually be `'123'`
|
|
249
|
+
* const result = await waitUntil.isString(
|
|
250
|
+
* () => {
|
|
251
|
+
* if (Math.random() < 0.5) {
|
|
252
|
+
* return 123;
|
|
253
|
+
* } else {
|
|
254
|
+
* return '123';
|
|
255
|
+
* }
|
|
256
|
+
* },
|
|
257
|
+
* {
|
|
258
|
+
* interval: {milliseconds: 100},
|
|
259
|
+
* timeout: {seconds: 10},
|
|
260
|
+
* },
|
|
261
|
+
* );
|
|
262
|
+
* ```
|
|
263
|
+
*
|
|
264
|
+
* @returns The successful callback return value.
|
|
265
|
+
* @throws {@link AssertionError} When the assertion fails.
|
|
266
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
267
|
+
*/
|
|
268
|
+
export declare const waitUntil: (<T>(callback: () => T, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<T>) & typeof waitUntilGroup;
|
|
269
|
+
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { extendableAssertions, waitUntilOverrides } from '../../assertions/extendable-assertions.js';
|
|
2
|
-
import { createWaitUntilGroup } from '../../guard-types/wait-until-function.js';
|
|
2
|
+
import { createWaitUntilGroup, executeWaitUntil, } from '../../guard-types/wait-until-function.js';
|
|
3
|
+
import { AssertionError } from '../assertion.error.js';
|
|
4
|
+
const waitUntilGroup = createWaitUntilGroup(extendableAssertions, waitUntilOverrides);
|
|
3
5
|
/**
|
|
4
6
|
* A group of guard methods that run the given callback multiple times until its return value
|
|
5
7
|
* matches expectations. Callback interval and timeout can be customized with
|
|
6
8
|
* {@link WaitUntilOptions}.
|
|
7
9
|
*
|
|
10
|
+
* This can also be called as a standalone wait until function which waits until the callback's
|
|
11
|
+
* returned value is truthy.
|
|
12
|
+
*
|
|
8
13
|
* @category Assert
|
|
14
|
+
* @category Package : @augment-vir/assert
|
|
9
15
|
* @example
|
|
10
16
|
*
|
|
11
17
|
* ```ts
|
|
@@ -29,6 +35,15 @@ import { createWaitUntilGroup } from '../../guard-types/wait-until-function.js';
|
|
|
29
35
|
*
|
|
30
36
|
* @returns The successful callback return value.
|
|
31
37
|
* @throws {@link AssertionError} When the assertion fails.
|
|
32
|
-
* @package
|
|
38
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
33
39
|
*/
|
|
34
|
-
export const waitUntil =
|
|
40
|
+
export const waitUntil = Object.assign(function waitUntil(input, failureMessage) {
|
|
41
|
+
return executeWaitUntil((input, failureMessage) => {
|
|
42
|
+
if (!input) {
|
|
43
|
+
throw new AssertionError('Assertion failed.', failureMessage);
|
|
44
|
+
}
|
|
45
|
+
}, [
|
|
46
|
+
input,
|
|
47
|
+
failureMessage,
|
|
48
|
+
], false);
|
|
49
|
+
}, waitUntilGroup);
|
|
@@ -4,7 +4,8 @@ import type { IsEqual } from 'type-fest';
|
|
|
4
4
|
* Otherwise it resolves to the given `No` type parameter.
|
|
5
5
|
*
|
|
6
6
|
* @category Assert : Util
|
|
7
|
-
* @
|
|
7
|
+
* @category Package : @augment-vir/assert
|
|
8
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
8
9
|
*/
|
|
9
10
|
export type IfEquals<Actual, Expected, Yes = unknown, No = never> = IsEqual<Actual, Expected> extends true ? Yes : No;
|
|
10
11
|
/**
|
|
@@ -12,6 +13,7 @@ export type IfEquals<Actual, Expected, Yes = unknown, No = never> = IsEqual<Actu
|
|
|
12
13
|
* Otherwise it resolves to the given `No` type parameter.
|
|
13
14
|
*
|
|
14
15
|
* @category Assert : Util
|
|
15
|
-
* @
|
|
16
|
+
* @category Package : @augment-vir/assert
|
|
17
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
16
18
|
*/
|
|
17
19
|
export type IfExtends<Actual, Expected, Yes = unknown, No = never> = Actual extends Expected ? Yes : No;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { AnyFunction, ExtractKeysWithMatchingValues, NarrowToExpected, Overwrite } from '@augment-vir/core';
|
|
2
2
|
import { AssertFunction } from './assert-function.js';
|
|
3
|
+
import { autoGuardSymbol } from './guard-override.js';
|
|
3
4
|
export type AssertWrapFunction<Output> = <Input>(input: Input, ...extraInputs: any[]) => NarrowToExpected<Input, Output>;
|
|
4
|
-
export type AssertWrapOverridesBase = Readonly<Record<
|
|
5
|
+
export type AssertWrapOverridesBase<Keys extends PropertyKey = string> = Readonly<Record<Keys, AnyFunction | undefined | typeof autoGuardSymbol>>;
|
|
5
6
|
export type AssertWrapGroup<Asserts extends Readonly<Record<string, AssertFunction<any>>>, AssertWrapOverrides extends AssertWrapOverridesBase> = Omit<Overwrite<{
|
|
6
7
|
[Name in keyof Asserts as Asserts[Name] extends AssertFunction<any> ? Name : never]: Asserts[Name] extends AssertFunction<infer Output> ? AssertWrapFunction<Output> : never;
|
|
7
|
-
},
|
|
8
|
+
}, {
|
|
9
|
+
[Name in keyof AssertWrapOverrides]: AssertWrapOverrides[Name] extends typeof autoGuardSymbol ? Name extends keyof Asserts ? Asserts[Name] extends AssertFunction<infer Output> ? AssertWrapFunction<Output> : never : never : AssertWrapOverrides[Name];
|
|
10
|
+
}>, ExtractKeysWithMatchingValues<AssertWrapOverrides, undefined>>;
|
|
8
11
|
export declare function createAssertWrapGroup<const Asserts extends Readonly<Record<string, AssertFunction<any>>>, const AssertWrapOverrides extends AssertWrapOverridesBase>(asserts: Asserts, assertWrapOverrides: AssertWrapOverrides): AssertWrapGroup<Asserts, AssertWrapOverrides>;
|
|
9
12
|
export declare function createAssertWrap<const Output>(assert: AssertFunction<Output>): AssertWrapFunction<Output>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ExtractKeysWithMatchingValues, MaybePromise, Overwrite, RemoveFirstTupleEntry, RemoveLastTupleEntry } from '@augment-vir/core';
|
|
2
2
|
import { AssertFunction } from './assert-function.js';
|
|
3
|
+
import { type autoGuardSymbol } from './guard-override.js';
|
|
3
4
|
export type CheckFunction<Output> = (input: any, ...extraInputs: any[]) => input is Output;
|
|
4
5
|
export type GenericCheckFunction = (input: any, ...extraInputs: any[]) => MaybePromise<boolean> | never;
|
|
5
|
-
export type CheckOverridesBase = Readonly<Record<
|
|
6
|
+
export type CheckOverridesBase<Keys extends PropertyKey = string> = Readonly<Record<Keys, CheckFunction<any> | GenericCheckFunction | undefined | typeof autoGuardSymbol>>;
|
|
6
7
|
export type CheckGroup<Asserts extends Readonly<Record<string, AssertFunction<any>>>, CheckOverrides extends CheckOverridesBase> = Omit<Overwrite<{
|
|
7
8
|
[Name in keyof Asserts as Asserts[Name] extends AssertFunction<any> ? Name : never]: Asserts[Name] extends AssertFunction<infer Output> ? (input: Parameters<Asserts[Name]>[0], ...params: RemoveLastTupleEntry<RemoveFirstTupleEntry<Parameters<Asserts[Name]>>>) => input is Output : never;
|
|
8
|
-
},
|
|
9
|
+
}, {
|
|
10
|
+
[Name in keyof CheckOverrides]: CheckOverrides[Name] extends typeof autoGuardSymbol ? Name extends keyof Asserts ? Asserts[Name] extends AssertFunction<infer Output> ? (input: Parameters<Asserts[Name]>[0], ...params: RemoveLastTupleEntry<RemoveFirstTupleEntry<Parameters<Asserts[Name]>>>) => input is Output : never : never : CheckOverrides[Name];
|
|
11
|
+
}>, ExtractKeysWithMatchingValues<CheckOverrides, undefined>>;
|
|
9
12
|
export declare function createCheckGroup<const Asserts extends Readonly<Record<string, AssertFunction<any>>>, const CheckOverrides extends CheckOverridesBase>(asserts: Asserts, checkOverrides: CheckOverrides): CheckGroup<Asserts, CheckOverrides>;
|
|
10
13
|
export declare function createCheck<const Output>(assert: AssertFunction<Output>): CheckFunction<Output>;
|
|
11
14
|
export declare function runAssertCheck<const Output, const Assert extends AssertFunction<Output>>(assert: Assert, input: Parameters<Assert>[0], ...inputs: RemoveFirstTupleEntry<RemoveLastTupleEntry<Parameters<Assert>>>): input is Output;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ExtractKeysWithMatchingValues, Overwrite, type NarrowToActual } from '@augment-vir/core';
|
|
2
2
|
import { AssertFunction } from './assert-function.js';
|
|
3
3
|
import { AssertWrapOverridesBase } from './assert-wrap-function.js';
|
|
4
|
+
import { autoGuardSymbol } from './guard-override.js';
|
|
4
5
|
export type CheckWrapFunction<Output> = <Input>(input: Input, ...extraInputs: any[]) => NarrowToActual<Input, Output> | undefined;
|
|
5
6
|
export type CheckWrapGroup<Asserts extends Readonly<Record<string, AssertFunction<any>>>, CheckWrapOverrides extends AssertWrapOverridesBase> = Omit<Overwrite<{
|
|
6
7
|
[Name in keyof Asserts as Asserts[Name] extends AssertFunction<any> ? Name : never]: Asserts[Name] extends AssertFunction<infer Output> ? CheckWrapFunction<Output> : never;
|
|
7
|
-
},
|
|
8
|
+
}, {
|
|
9
|
+
[Name in keyof CheckWrapOverrides]: CheckWrapOverrides[Name] extends typeof autoGuardSymbol ? Name extends keyof Asserts ? Asserts[Name] extends AssertFunction<infer Output> ? CheckWrapFunction<Output> : never : never : CheckWrapOverrides[Name];
|
|
10
|
+
}>, ExtractKeysWithMatchingValues<CheckWrapOverrides, undefined>>;
|
|
8
11
|
export declare function createCheckWrapGroup<const Asserts extends Readonly<Record<string, AssertFunction<any>>>, const CheckWrapOverrides extends AssertWrapOverridesBase>(asserts: Asserts, checkWrapOverrides: CheckWrapOverrides): CheckWrapGroup<Asserts, CheckWrapOverrides>;
|
|
9
12
|
export declare function createCheckWrap<const Output>(assert: AssertFunction<Output>): CheckWrapFunction<Output>;
|
|
@@ -3,11 +3,10 @@ import type { AssertFunction } from './assert-function.js';
|
|
|
3
3
|
import type { AssertWrapOverridesBase } from './assert-wrap-function.js';
|
|
4
4
|
import type { CheckOverridesBase } from './check-function.js';
|
|
5
5
|
import type { WaitUntilOverridesBase } from './wait-until-function.js';
|
|
6
|
-
export type GuardGroup = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}>;
|
|
6
|
+
export type GuardGroup<Assertions extends Record<string, AssertFunction<any>>> = {
|
|
7
|
+
assert: Assertions;
|
|
8
|
+
check: CheckOverridesBase<keyof Assertions>;
|
|
9
|
+
assertWrap: AssertWrapOverridesBase<keyof Assertions>;
|
|
10
|
+
checkWrap: AssertWrapOverridesBase<keyof Assertions>;
|
|
11
|
+
waitUntil: WaitUntilOverridesBase<keyof Assertions>;
|
|
12
|
+
};
|
|
@@ -2,11 +2,13 @@ import type { AnyFunction, MaybePromise, NarrowToExpected, PartialWithUndefined,
|
|
|
2
2
|
import { ExtractKeysWithMatchingValues, Overwrite } from '@augment-vir/core';
|
|
3
3
|
import { AnyDuration } from '@date-vir/duration';
|
|
4
4
|
import type { AssertFunction } from './assert-function.js';
|
|
5
|
+
import { autoGuardSymbol } from './guard-override.js';
|
|
5
6
|
/**
|
|
6
7
|
* Options for configuring the timing of `waitUntil`.
|
|
7
8
|
*
|
|
8
9
|
* @category Assert : Util
|
|
9
|
-
* @
|
|
10
|
+
* @category Package : @augment-vir/assert
|
|
11
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
10
12
|
*/
|
|
11
13
|
export type WaitUntilOptions = PartialWithUndefined<{
|
|
12
14
|
/**
|
|
@@ -24,7 +26,8 @@ export type WaitUntilOptions = PartialWithUndefined<{
|
|
|
24
26
|
timeout: AnyDuration;
|
|
25
27
|
}>;
|
|
26
28
|
export declare const defaultWaitUntilOptions: RequiredAndNotNull<WaitUntilOptions>;
|
|
27
|
-
export
|
|
29
|
+
export declare function executeWaitUntil<const Assert extends AssertFunction<any>>(this: void, assert: AssertFunction<any>, rawArgs: unknown[], requireSynchronousResult: boolean): Promise<ReturnType<WaitUntilFunction<Assert>>>;
|
|
30
|
+
export type WaitUntilOverridesBase<Keys extends PropertyKey = string> = Readonly<Record<Keys, AnyFunction | typeof autoGuardSymbol | undefined>>;
|
|
28
31
|
export type WaitUntilFunctionParameters<Assert extends AssertFunction<any>, Input> = [
|
|
29
32
|
...RemoveFirstTupleEntry<RemoveLastTupleEntry<Parameters<Assert>>>,
|
|
30
33
|
() => MaybePromise<Input>
|
|
@@ -36,7 +39,9 @@ export type WaitUntilFunction<Assert extends AssertFunction<any>> = Assert exten
|
|
|
36
39
|
]) => Promise<NarrowToExpected<Input, Guard>> : never;
|
|
37
40
|
type WaitUntilGroup<Asserts extends Readonly<Record<string, AssertFunction<any>>>, WaitUntilOverrides extends WaitUntilOverridesBase> = Omit<Overwrite<{
|
|
38
41
|
[Name in keyof Asserts as Asserts[Name] extends AssertFunction<any> ? Name : never]: WaitUntilFunction<Asserts[Name]>;
|
|
39
|
-
},
|
|
42
|
+
}, {
|
|
43
|
+
[Name in keyof WaitUntilOverrides]: WaitUntilOverrides[Name] extends typeof autoGuardSymbol ? Name extends keyof Asserts ? Asserts[Name] extends AssertFunction<any> ? WaitUntilFunction<Asserts[Name]> : never : never : WaitUntilOverrides[Name];
|
|
44
|
+
}>, ExtractKeysWithMatchingValues<WaitUntilOverrides, undefined>>;
|
|
40
45
|
export declare function createWaitUntilGroup<const Asserts extends Readonly<Record<string, AssertFunction<any>>>, const WaitUntilOverrides extends WaitUntilOverridesBase>(asserts: Asserts, waitUntilOverrides: WaitUntilOverrides): WaitUntilGroup<Asserts, WaitUntilOverrides>;
|
|
41
46
|
export declare function createWaitUntil<const Assert extends AssertFunction<any>>(assert: Assert, requireSynchronousResult?: boolean): WaitUntilFunction<Assert>;
|
|
42
47
|
export declare function parseWaitUntilArgs(rawArgs: unknown[]): {
|
|
@@ -10,7 +10,7 @@ export const defaultWaitUntilOptions = {
|
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
const notSetSymbol = Symbol('not set');
|
|
13
|
-
async function executeWaitUntil(assert, rawArgs, requireSynchronousResult) {
|
|
13
|
+
export async function executeWaitUntil(assert, rawArgs, requireSynchronousResult) {
|
|
14
14
|
const { callback, extraAssertionArgs, failureMessage, options } = parseWaitUntilArgs(rawArgs);
|
|
15
15
|
const timeout = convertDuration(options.timeout, DurationUnit.Milliseconds).milliseconds;
|
|
16
16
|
const interval = convertDuration(options.interval, DurationUnit.Milliseconds);
|
package/package.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/assert",
|
|
3
|
-
"version": "30.0.
|
|
3
|
+
"version": "30.0.1",
|
|
4
|
+
"description": "A collection of assertions for test and production code alike.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"augment",
|
|
7
|
+
"helper",
|
|
8
|
+
"util",
|
|
9
|
+
"node",
|
|
10
|
+
"browser",
|
|
11
|
+
"backend",
|
|
12
|
+
"frontend",
|
|
13
|
+
"assert",
|
|
14
|
+
"test",
|
|
15
|
+
"chai",
|
|
16
|
+
"vir",
|
|
17
|
+
"augment-vir"
|
|
18
|
+
],
|
|
4
19
|
"homepage": "https://github.com/electrovir/augment-vir",
|
|
5
20
|
"bugs": {
|
|
6
21
|
"url": "https://github.com/electrovir/augment-vir/issues"
|
|
@@ -20,15 +35,13 @@
|
|
|
20
35
|
"types": "dist/index.d.ts",
|
|
21
36
|
"scripts": {
|
|
22
37
|
"compile": "virmator compile",
|
|
23
|
-
"docs": "virmator docs",
|
|
24
38
|
"start": "tsx src/index.ts",
|
|
25
39
|
"test": "virmator test node --no-deps",
|
|
26
40
|
"test:coverage": "npm run test coverage",
|
|
27
|
-
"test:docs": "virmator docs check",
|
|
28
41
|
"test:update": "npm test"
|
|
29
42
|
},
|
|
30
43
|
"dependencies": {
|
|
31
|
-
"@augment-vir/core": "^30.0.
|
|
44
|
+
"@augment-vir/core": "^30.0.1",
|
|
32
45
|
"@date-vir/duration": "^6.0.0",
|
|
33
46
|
"deep-eql": "^5.0.2",
|
|
34
47
|
"expect-type": "^0.20.0",
|