@dereekb/util 13.11.2 → 13.11.3
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/eslint/index.cjs.default.js +1 -0
- package/eslint/index.cjs.js +607 -0
- package/eslint/index.cjs.mjs +2 -0
- package/eslint/index.d.ts +1 -0
- package/eslint/index.esm.js +603 -0
- package/eslint/package.json +23 -0
- package/eslint/src/index.d.ts +1 -0
- package/eslint/src/lib/comments.d.ts +54 -0
- package/eslint/src/lib/index.d.ts +3 -0
- package/eslint/src/lib/plugin.d.ts +18 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +42 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +54 -0
- package/fetch/package.json +2 -2
- package/index.cjs.js +1203 -23
- package/index.esm.js +1203 -23
- package/package.json +7 -1
- package/src/lib/array/array.factory.d.ts +2 -0
- package/src/lib/array/array.filter.d.ts +50 -17
- package/src/lib/array/array.find.d.ts +1 -0
- package/src/lib/array/array.index.d.ts +7 -0
- package/src/lib/array/array.indexed.d.ts +21 -0
- package/src/lib/array/array.make.d.ts +7 -0
- package/src/lib/array/array.random.d.ts +1 -0
- package/src/lib/array/array.unique.d.ts +3 -0
- package/src/lib/array/array.value.d.ts +7 -0
- package/src/lib/auth/auth.role.claims.d.ts +7 -0
- package/src/lib/boolean.d.ts +1 -0
- package/src/lib/contact/random.d.ts +14 -0
- package/src/lib/date/date.d.ts +6 -0
- package/src/lib/date/time.d.ts +7 -0
- package/src/lib/date/week.d.ts +7 -0
- package/src/lib/error/error.d.ts +7 -0
- package/src/lib/filter/filter.d.ts +7 -0
- package/src/lib/function/function.boolean.d.ts +7 -0
- package/src/lib/function/function.forward.d.ts +14 -0
- package/src/lib/getter/getter.cache.d.ts +7 -0
- package/src/lib/getter/getter.d.ts +34 -0
- package/src/lib/getter/getter.map.d.ts +7 -0
- package/src/lib/getter/getter.util.d.ts +7 -0
- package/src/lib/grouping.d.ts +8 -0
- package/src/lib/hash.d.ts +1 -0
- package/src/lib/key.d.ts +16 -0
- package/src/lib/map/map.key.d.ts +14 -0
- package/src/lib/model/id.batch.d.ts +7 -0
- package/src/lib/model/id.factory.d.ts +7 -0
- package/src/lib/model/model.conversion.d.ts +35 -0
- package/src/lib/model/model.copy.d.ts +7 -0
- package/src/lib/model/model.d.ts +19 -0
- package/src/lib/model/model.modify.d.ts +14 -0
- package/src/lib/nodejs/stream.d.ts +7 -0
- package/src/lib/number/bound.d.ts +3 -0
- package/src/lib/number/dollar.d.ts +7 -0
- package/src/lib/number/factory.d.ts +7 -0
- package/src/lib/number/random.d.ts +1 -0
- package/src/lib/number/round.d.ts +22 -0
- package/src/lib/number/sort.d.ts +7 -0
- package/src/lib/number/transform.d.ts +7 -0
- package/src/lib/object/object.array.delta.d.ts +7 -0
- package/src/lib/object/object.equal.d.ts +7 -0
- package/src/lib/object/object.filter.pojo.d.ts +87 -0
- package/src/lib/object/object.filter.tuple.d.ts +16 -0
- package/src/lib/object/object.key.d.ts +14 -0
- package/src/lib/object/object.map.d.ts +14 -0
- package/src/lib/path/path.d.ts +9 -0
- package/src/lib/promise/promise.d.ts +21 -0
- package/src/lib/promise/promise.factory.d.ts +7 -0
- package/src/lib/promise/promise.task.d.ts +7 -0
- package/src/lib/service/handler.config.d.ts +28 -0
- package/src/lib/service/handler.d.ts +14 -0
- package/src/lib/set/set.d.ts +21 -0
- package/src/lib/set/set.decision.d.ts +7 -0
- package/src/lib/set/set.delta.d.ts +7 -0
- package/src/lib/set/set.selection.d.ts +7 -0
- package/src/lib/sort.d.ts +8 -0
- package/src/lib/string/char.d.ts +7 -0
- package/src/lib/string/dencoder.d.ts +35 -0
- package/src/lib/string/factory.d.ts +22 -1
- package/src/lib/string/replace.d.ts +78 -0
- package/src/lib/string/search.d.ts +7 -0
- package/src/lib/string/sort.d.ts +7 -0
- package/src/lib/string/string.d.ts +1 -0
- package/src/lib/string/transform.d.ts +53 -0
- package/src/lib/string/tree.d.ts +7 -0
- package/src/lib/string/url.d.ts +7 -0
- package/src/lib/tree/tree.array.d.ts +1 -0
- package/src/lib/tree/tree.explore.d.ts +3 -0
- package/src/lib/type.d.ts +3 -2
- package/src/lib/value/bound.d.ts +28 -0
- package/src/lib/value/comparator.d.ts +16 -0
- package/src/lib/value/decision.d.ts +5 -0
- package/src/lib/value/equal.d.ts +2 -0
- package/src/lib/value/indexed.d.ts +127 -0
- package/src/lib/value/map.d.ts +22 -0
- package/src/lib/value/maybe.type.d.ts +2 -2
- package/src/lib/value/modifier.d.ts +13 -0
- package/src/lib/value/point.d.ts +56 -0
- package/src/lib/value/use.d.ts +37 -0
- package/src/lib/value/vector.d.ts +7 -0
- package/test/index.cjs.js +17 -4
- package/test/index.esm.js +17 -4
- package/test/package.json +2 -2
- package/test/src/lib/shared/shared.fail.d.ts +24 -5
package/test/index.esm.js
CHANGED
|
@@ -1088,8 +1088,9 @@ function _ts_generator(thisArg, body) {
|
|
|
1088
1088
|
/**
|
|
1089
1089
|
* Throws an {@link ExpectedFailError} to signal that a test reached the expected failure point.
|
|
1090
1090
|
*
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
1091
|
+
* Must be called inside {@link shouldFail} (typically via {@link itShouldFail}) or {@link expectSuccessfulFail},
|
|
1092
|
+
* which catch `ExpectedFailError` and convert it into a passing test. Calling it inside a plain
|
|
1093
|
+
* `it()` block causes the test to fail because the error propagates uncaught.
|
|
1093
1094
|
*
|
|
1094
1095
|
* @param message - optional error message
|
|
1095
1096
|
*/ function failSuccessfully(message) {
|
|
@@ -1168,11 +1169,23 @@ function _ts_generator(thisArg, body) {
|
|
|
1168
1169
|
};
|
|
1169
1170
|
}
|
|
1170
1171
|
/**
|
|
1171
|
-
* Function that expects any failure to be thrown, then throws an ExpectedFailError.
|
|
1172
|
+
* Function that expects any failure to be thrown, then throws an {@link ExpectedFailError}.
|
|
1173
|
+
*
|
|
1174
|
+
* Intended to be used inside {@link itShouldFail} or {@link shouldFail}, which catch the
|
|
1175
|
+
* `ExpectedFailError` and treat it as a passing test. When used inside a plain `it()` block
|
|
1176
|
+
* the thrown `ExpectedFailError` propagates and fails the test even though `errorFn` rejected
|
|
1177
|
+
* as expected — for that case use vitest's `await expect(...).rejects.toThrow(...)` instead.
|
|
1172
1178
|
*
|
|
1173
1179
|
* @param errorFn - function expected to throw an error (sync or async)
|
|
1174
1180
|
* @param assertFailType - optional assertion to validate the type or content of the thrown error
|
|
1175
|
-
* @returns a promise that
|
|
1181
|
+
* @returns a promise that rejects with {@link ExpectedFailError} when the expected failure is verified, or with {@link UnexpectedSuccessFailureError} when `errorFn` resolves successfully
|
|
1182
|
+
*
|
|
1183
|
+
* @example
|
|
1184
|
+
* ```ts
|
|
1185
|
+
* itShouldFail('when the user is not authorized', async () => {
|
|
1186
|
+
* await expectFail(() => callProtectedEndpoint(), expectFailAssertHttpErrorServerErrorCode(403));
|
|
1187
|
+
* });
|
|
1188
|
+
* ```
|
|
1176
1189
|
*/ function expectFail(errorFn, assertFailType) {
|
|
1177
1190
|
function handleError(e) {
|
|
1178
1191
|
if (_instanceof(e, UnexpectedSuccessFailureError)) {
|
package/test/package.json
CHANGED
|
@@ -19,8 +19,9 @@ export declare function failSuccessfullyError(message?: string): ExpectedFailErr
|
|
|
19
19
|
/**
|
|
20
20
|
* Throws an {@link ExpectedFailError} to signal that a test reached the expected failure point.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Must be called inside {@link shouldFail} (typically via {@link itShouldFail}) or {@link expectSuccessfulFail},
|
|
23
|
+
* which catch `ExpectedFailError` and convert it into a passing test. Calling it inside a plain
|
|
24
|
+
* `it()` block causes the test to fail because the error propagates uncaught.
|
|
24
25
|
*
|
|
25
26
|
* @param message - optional error message
|
|
26
27
|
*/
|
|
@@ -80,15 +81,33 @@ export type ExpectFailAssertionFunction = (error: unknown) => PromiseOrValue<May
|
|
|
80
81
|
*/
|
|
81
82
|
export declare function expectFailAssertErrorType(expectedType: ClassType | ClassLikeType | typeof Error | any): ExpectFailAssertionFunction;
|
|
82
83
|
/**
|
|
83
|
-
* Function that expects any failure to be thrown, then throws an ExpectedFailError.
|
|
84
|
+
* Function that expects any failure to be thrown, then throws an {@link ExpectedFailError}.
|
|
85
|
+
*
|
|
86
|
+
* Intended to be used inside {@link itShouldFail} or {@link shouldFail}, which catch the
|
|
87
|
+
* `ExpectedFailError` and treat it as a passing test. When used inside a plain `it()` block
|
|
88
|
+
* the thrown `ExpectedFailError` propagates and fails the test even though `errorFn` rejected
|
|
89
|
+
* as expected — for that case use vitest's `await expect(...).rejects.toThrow(...)` instead.
|
|
84
90
|
*
|
|
85
91
|
* @param errorFn - function expected to throw an error (sync or async)
|
|
86
92
|
* @param assertFailType - optional assertion to validate the type or content of the thrown error
|
|
87
|
-
* @returns a promise that
|
|
93
|
+
* @returns a promise that rejects with {@link ExpectedFailError} when the expected failure is verified, or with {@link UnexpectedSuccessFailureError} when `errorFn` resolves successfully
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* itShouldFail('when the user is not authorized', async () => {
|
|
98
|
+
* await expectFail(() => callProtectedEndpoint(), expectFailAssertHttpErrorServerErrorCode(403));
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
88
101
|
*/
|
|
89
102
|
export declare function expectFail(errorFn: () => PromiseOrValue<any>, assertFailType?: ExpectFailAssertionFunction): Promise<void>;
|
|
90
103
|
/**
|
|
91
|
-
* Function that expects an ExpectedFailError to be thrown
|
|
104
|
+
* Function that expects an {@link ExpectedFailError} to be thrown by `errorFn`.
|
|
105
|
+
*
|
|
106
|
+
* Lower-level building block used by {@link shouldFail}; most consumer tests should use
|
|
107
|
+
* {@link itShouldFail} + {@link expectFail} (or {@link failSuccessfully}) rather than calling
|
|
108
|
+
* this directly. If `errorFn` resolves without throwing, this calls `handleError` with an
|
|
109
|
+
* {@link UnexpectedSuccessFailureError}; if it throws something other than `ExpectedFailError`,
|
|
110
|
+
* `handleError` likewise rejects the surrounding test.
|
|
92
111
|
*
|
|
93
112
|
* @param errorFn - function expected to throw (sync or async); if it succeeds, the test fails
|
|
94
113
|
* @param handleError - optional custom error handler; defaults to {@link EXPECT_ERROR_DEFAULT_HANDLER}
|