@augment-vir/assert 30.0.3 → 30.0.5
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/dist/assertions/boolean.d.ts +2 -2
- package/dist/assertions/boundary.d.ts +2 -2
- package/dist/assertions/enum.d.ts +2 -2
- package/dist/assertions/equality/entry-equality.d.ts +2 -2
- package/dist/assertions/equality/json-equality.d.ts +2 -2
- package/dist/assertions/equality/json-equality.js +1 -1
- package/dist/assertions/equality/simple-equality.d.ts +2 -2
- package/dist/assertions/equality/ts-type-equality.d.ts +1 -1
- package/dist/assertions/extendable-assertions.d.ts +43 -914
- package/dist/assertions/http.d.ts +1 -1
- package/dist/assertions/instance.d.ts +3 -3
- package/dist/assertions/keys.d.ts +3 -3
- package/dist/assertions/keys.js +1 -1
- package/dist/assertions/length.d.ts +2 -2
- package/dist/assertions/nullish.d.ts +2 -2
- package/dist/assertions/output.d.ts +2 -2
- package/dist/assertions/primitive.d.ts +3 -3
- package/dist/assertions/promise.d.ts +1 -1
- package/dist/assertions/runtime-type.d.ts +9 -8
- package/dist/assertions/runtime-type.js +4 -4
- package/dist/assertions/throws.d.ts +2 -2
- package/dist/assertions/uuid.d.ts +2 -2
- package/dist/assertions/values.d.ts +2 -2
- package/dist/augments/guards/assert-wrap.d.ts +3 -254
- package/dist/augments/guards/assert.d.ts +4 -155
- package/dist/augments/guards/assert.js +6 -3
- package/dist/augments/guards/check-wrap.d.ts +4 -255
- package/dist/augments/guards/check-wrap.js +1 -1
- package/dist/augments/guards/check.d.ts +4 -255
- package/dist/augments/guards/wait-until.d.ts +3 -232
- package/dist/guard-types/assert-wrap-function.d.ts +2 -2
- package/dist/guard-types/check-function.d.ts +2 -2
- package/dist/guard-types/check-wrap-wrapper-function.d.ts +3 -3
- package/dist/guard-types/guard-override.d.ts +1 -1
- package/dist/guard-types/wait-until-function.d.ts +3 -4
- package/dist/index.d.ts +1 -1
- package/dist/test-timeout.mock.d.ts +2 -2
- package/package.json +2 -2
- package/dist/assertions/output.example.d.ts +0 -1
- package/dist/assertions/output.example.js +0 -13
- package/dist/assertions/runtime-type.example.d.ts +0 -1
- package/dist/assertions/runtime-type.example.js +0 -3
- package/dist/assertions/throws.example.d.ts +0 -1
- package/dist/assertions/throws.example.js +0 -11
- package/dist/augments/assertion.error.example.d.ts +0 -1
- package/dist/augments/assertion.error.example.js +0 -3
- package/dist/augments/guards/assert-wrap.example.d.ts +0 -1
- package/dist/augments/guards/assert-wrap.example.js +0 -9
- package/dist/augments/guards/assert.example.d.ts +0 -1
- package/dist/augments/guards/assert.example.js +0 -4
- package/dist/augments/guards/check-wrap.example.d.ts +0 -1
- package/dist/augments/guards/check-wrap.example.js +0 -9
- package/dist/augments/guards/check.example.d.ts +0 -1
- package/dist/augments/guards/check.example.js +0 -5
- package/dist/augments/guards/wait-until.example.d.ts +0 -1
- package/dist/augments/guards/wait-until.example.js +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnyFunction, MaybePromise, NarrowToExpected, PartialWithUndefined, RemoveFirstTupleEntry, RemoveLastTupleEntry, RequiredAndNotNull } from '@augment-vir/core';
|
|
2
|
-
import { ExtractKeysWithMatchingValues, Overwrite } from '@augment-vir/core';
|
|
3
|
-
import { AnyDuration } from '@date-vir/duration';
|
|
2
|
+
import { type ExtractKeysWithMatchingValues, type Overwrite } from '@augment-vir/core';
|
|
3
|
+
import { type AnyDuration } from '@date-vir/duration';
|
|
4
4
|
import type { AssertFunction } from './assert-function.js';
|
|
5
5
|
import { autoGuardSymbol } from './guard-override.js';
|
|
6
6
|
/**
|
|
@@ -37,7 +37,7 @@ export type WaitUntilFunction<Assert extends AssertFunction<any>> = Assert exten
|
|
|
37
37
|
options?: WaitUntilOptions | undefined,
|
|
38
38
|
failureMessage?: string | undefined
|
|
39
39
|
]) => Promise<NarrowToExpected<Input, Guard>> : never;
|
|
40
|
-
type WaitUntilGroup<Asserts extends Readonly<Record<string, AssertFunction<any>>>, WaitUntilOverrides extends WaitUntilOverridesBase> = Omit<Overwrite<{
|
|
40
|
+
export type WaitUntilGroup<Asserts extends Readonly<Record<string, AssertFunction<any>>>, WaitUntilOverrides extends WaitUntilOverridesBase> = Omit<Overwrite<{
|
|
41
41
|
[Name in keyof Asserts as Asserts[Name] extends AssertFunction<any> ? Name : never]: WaitUntilFunction<Asserts[Name]>;
|
|
42
42
|
}, {
|
|
43
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];
|
|
@@ -65,4 +65,3 @@ export declare function parseWaitUntilArgs(rawArgs: unknown[]): {
|
|
|
65
65
|
failureMessage: string | undefined;
|
|
66
66
|
};
|
|
67
67
|
export declare function parseWaitUntilOptions(rawOptions: WaitUntilOptions | undefined): RequiredAndNotNull<WaitUntilOptions>;
|
|
68
|
-
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export * from './augments/guards/check-wrap.js';
|
|
|
6
6
|
export * from './augments/guards/check.js';
|
|
7
7
|
export * from './augments/guards/wait-until.js';
|
|
8
8
|
export * from './augments/if-equals.js';
|
|
9
|
-
export type
|
|
9
|
+
export { type WaitUntilOptions } from './guard-types/wait-until-function.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RequiredAndNotNull } from '@augment-vir/core';
|
|
2
|
-
import type
|
|
1
|
+
import { type RequiredAndNotNull } from '@augment-vir/core';
|
|
2
|
+
import { type WaitUntilOptions } from './guard-types/wait-until-function.js';
|
|
3
3
|
export declare const waitUntilTestOptions: RequiredAndNotNull<WaitUntilOptions>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/assert",
|
|
3
|
-
"version": "30.0.
|
|
3
|
+
"version": "30.0.5",
|
|
4
4
|
"description": "A collection of assertions for test and production code alike.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augment",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test:update": "npm test"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@augment-vir/core": "^30.0.
|
|
44
|
+
"@augment-vir/core": "^30.0.5",
|
|
45
45
|
"@date-vir/duration": "^6.0.0",
|
|
46
46
|
"deep-eql": "^5.0.2",
|
|
47
47
|
"expect-type": "^0.20.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { assert, AssertionError } from '@augment-vir/assert';
|
|
2
|
-
function myFunctionToTest(name) {
|
|
3
|
-
return `Hello there ${name}`;
|
|
4
|
-
}
|
|
5
|
-
const myCustomAsserter = (actual, expected, failureMessage) => {
|
|
6
|
-
// Write your assertion in an `if`.
|
|
7
|
-
if (!actual.startsWith('hello there') || actual.endsWith(expected)) {
|
|
8
|
-
// Throw an `AssertionError` if the `if` fails.
|
|
9
|
-
throw new AssertionError('', failureMessage);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
// Use your custom asserter as the first input to any `.output` guard.
|
|
13
|
-
assert.output(myCustomAsserter, myFunctionToTest, ['John'], 'John', 'Name insertion failed');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { assert } from '@augment-vir/assert';
|
|
2
|
-
// define the options
|
|
3
|
-
const matchOptions = {
|
|
4
|
-
matchConstructor: Error,
|
|
5
|
-
matchMessage: 'some error',
|
|
6
|
-
};
|
|
7
|
-
assert.throws(() => {
|
|
8
|
-
throw new Error('some error');
|
|
9
|
-
},
|
|
10
|
-
// use the options
|
|
11
|
-
matchOptions); // this assertion will pass
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { assertWrap } from '@augment-vir/assert';
|
|
2
|
-
// `result1` will be `['a']`
|
|
3
|
-
const result1 = assertWrap.deepEquals(['a'], ['a']);
|
|
4
|
-
const value = 'some value';
|
|
5
|
-
// `result2` will be `'some value'` and it will have the type of `string`
|
|
6
|
-
const result2 = assertWrap.isString(value);
|
|
7
|
-
const value2 = 'some value';
|
|
8
|
-
// this will throw an error
|
|
9
|
-
const result3 = assertWrap.isNumber(value2);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { checkWrap } from '@augment-vir/assert';
|
|
2
|
-
// `result1` will be `['a']`
|
|
3
|
-
const result1 = checkWrap.deepEquals(['a'], ['a']);
|
|
4
|
-
const value = 'some value';
|
|
5
|
-
// `result2` will be `'some value'` and it will have the type of `string`
|
|
6
|
-
const result2 = checkWrap.isString(value);
|
|
7
|
-
const value2 = 'some value';
|
|
8
|
-
// `result` will be `undefined`
|
|
9
|
-
const result3 = checkWrap.isNumber(value2);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { waitUntil } from '@augment-vir/assert';
|
|
2
|
-
// `result` will eventually be `'123'`
|
|
3
|
-
const result = await waitUntil.isString(() => {
|
|
4
|
-
if (Math.random() < 0.5) {
|
|
5
|
-
return 123;
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
return '123';
|
|
9
|
-
}
|
|
10
|
-
}, {
|
|
11
|
-
interval: { milliseconds: 100 },
|
|
12
|
-
timeout: { seconds: 10 },
|
|
13
|
-
});
|