@dereekb/util 10.1.30 → 11.0.0
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/fetch/LICENSE +21 -0
- package/fetch/index.cjs.d.ts +1 -0
- package/fetch/index.cjs.js +5558 -0
- package/fetch/index.esm.js +5448 -0
- package/fetch/package.json +15 -3
- package/fetch/src/lib/error.d.ts +7 -0
- package/fetch/src/lib/fetch.d.ts +5 -5
- package/fetch/src/lib/fetch.page.d.ts +116 -0
- package/fetch/src/lib/index.d.ts +1 -0
- package/fetch/src/lib/json.d.ts +17 -1
- package/index.cjs.js +5155 -3866
- package/index.esm.js +1610 -1457
- package/package.json +10 -5
- package/src/lib/array/array.d.ts +0 -12
- package/src/lib/date/date.d.ts +22 -1
- package/src/lib/model/model.d.ts +1 -0
- package/src/lib/number/round.d.ts +2 -1
- package/src/lib/object/object.equal.d.ts +2 -0
- package/src/lib/page/page.calculator.d.ts +6 -1
- package/src/lib/page/page.d.ts +0 -2
- package/src/lib/promise/index.d.ts +1 -0
- package/src/lib/promise/promise.factory.d.ts +33 -0
- package/src/lib/string/char.d.ts +4 -0
- package/src/lib/string/replace.d.ts +29 -1
- package/src/lib/value/point.d.ts +1 -1
- package/test/CHANGELOG.md +13 -0
- package/test/package.json +1 -1
- package/test/src/lib/jest.fail.d.ts +22 -3
- package/test/src/lib/jest.fail.js +30 -3
- package/test/src/lib/jest.fail.js.map +1 -1
- package/test/src/lib/jest.js +8 -7
- package/test/src/lib/jest.js.map +1 -1
- package/test/src/lib/jest.wrap.js +16 -15
- package/test/src/lib/jest.wrap.js.map +1 -1
- package/fetch/CHANGELOG.md +0 -931
- package/fetch/src/index.js +0 -5
- package/fetch/src/index.js.map +0 -1
- package/fetch/src/lib/error.js +0 -31
- package/fetch/src/lib/error.js.map +0 -1
- package/fetch/src/lib/fetch.js +0 -177
- package/fetch/src/lib/fetch.js.map +0 -1
- package/fetch/src/lib/fetch.type.js +0 -3
- package/fetch/src/lib/fetch.type.js.map +0 -1
- package/fetch/src/lib/index.js +0 -11
- package/fetch/src/lib/index.js.map +0 -1
- package/fetch/src/lib/json.js +0 -80
- package/fetch/src/lib/json.js.map +0 -1
- package/fetch/src/lib/provider.js +0 -9
- package/fetch/src/lib/provider.js.map +0 -1
- package/fetch/src/lib/timeout.js +0 -38
- package/fetch/src/lib/timeout.js.map +0 -1
- package/fetch/src/lib/url.js +0 -102
- package/fetch/src/lib/url.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -22,15 +22,20 @@
|
|
|
22
22
|
},
|
|
23
23
|
"./fetch": {
|
|
24
24
|
"types": "./fetch/src/index.d.ts",
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
"node": {
|
|
26
|
+
"require": "./fetch/index.cjs.js",
|
|
27
|
+
"import": "./fetch/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"browser": {
|
|
30
|
+
"require": "./fetch/index.cjs.js",
|
|
31
|
+
"import": "./fetch/index.esm.js"
|
|
32
|
+
},
|
|
33
|
+
"default": "./fetch/index.cjs.js"
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
36
|
"peerDependencies": {
|
|
31
37
|
"make-error": "^1.3.0",
|
|
32
38
|
"ts-essentials": "^9.1.2",
|
|
33
|
-
"lodash": "4.17.21",
|
|
34
39
|
"extra-set": "^3.0.0"
|
|
35
40
|
},
|
|
36
41
|
"dependencies": {},
|
package/src/lib/array/array.d.ts
CHANGED
|
@@ -118,15 +118,3 @@ export declare function forEachWithArray<T>(array: Maybe<ArrayOrValue<T>>, forEa
|
|
|
118
118
|
* @returns
|
|
119
119
|
*/
|
|
120
120
|
export declare function countAllInNestedArray<T>(array: T[][]): number;
|
|
121
|
-
/**
|
|
122
|
-
* @deprecated Use mergeArraysIntoArray() instead. Will be removed in v10.1.
|
|
123
|
-
*/
|
|
124
|
-
export declare const mergeIntoArray: typeof mergeArraysIntoArray;
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Use pushArrayItemsIntoArray() instead. Will be removed in v10.1.
|
|
127
|
-
*/
|
|
128
|
-
export declare const mergeArrayIntoArray: typeof pushArrayItemsIntoArray;
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated Use pushArrayItemsOrItemIntoArray() instead. Will be removed in v10.1.
|
|
131
|
-
*/
|
|
132
|
-
export declare const mergeArrayOrValueIntoArray: typeof pushItemOrArrayItemsIntoArray;
|
package/src/lib/date/date.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { type Maybe } from '../value/maybe.type';
|
|
|
3
3
|
* The past or future direction.
|
|
4
4
|
*/
|
|
5
5
|
export type DateRelativeDirection = 'past' | 'future';
|
|
6
|
+
/**
|
|
7
|
+
* Hour, minute, or second as a string.
|
|
8
|
+
*/
|
|
9
|
+
export type DateHourMinuteOrSecond = 'hour' | 'minute' | 'second';
|
|
6
10
|
/**
|
|
7
11
|
* A valid ISO8601 formatted date string.
|
|
8
12
|
*
|
|
@@ -10,7 +14,7 @@ export type DateRelativeDirection = 'past' | 'future';
|
|
|
10
14
|
*/
|
|
11
15
|
export type ISO8601DateString = string;
|
|
12
16
|
/**
|
|
13
|
-
* TODO: Need to improve to support negative years.
|
|
17
|
+
* TODO(FUTURE): Need to improve to support negative years.
|
|
14
18
|
*/
|
|
15
19
|
export declare const ISO_8601_DATE_STRING_REGEX: RegExp;
|
|
16
20
|
export declare function isISO8601DateString(input: string): input is ISO8601DateString;
|
|
@@ -154,6 +158,8 @@ export declare function isMonthDaySlashDate(input: string): input is MonthDaySla
|
|
|
154
158
|
export declare function monthDaySlashDateToDateString(slashDate: MonthDaySlashDate): ISO8601DayString;
|
|
155
159
|
/**
|
|
156
160
|
* Time in seconds (instead of ms) since the epoch.
|
|
161
|
+
*
|
|
162
|
+
* Returned by Date.getTime().
|
|
157
163
|
*/
|
|
158
164
|
export type UnixDateTimeNumber = number;
|
|
159
165
|
/**
|
|
@@ -211,3 +217,18 @@ export type DateRelativeState = DateRelativeDirection | 'present';
|
|
|
211
217
|
* @returns
|
|
212
218
|
*/
|
|
213
219
|
export declare function isDate(value: unknown): value is Date;
|
|
220
|
+
/**
|
|
221
|
+
* Returns true if the two input dates are equal.
|
|
222
|
+
*
|
|
223
|
+
* @param a
|
|
224
|
+
* @param b
|
|
225
|
+
* @returns
|
|
226
|
+
*/
|
|
227
|
+
export declare function isEqualDate(a: Date, b: Date): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Returns true if the input date is in the past.
|
|
230
|
+
*
|
|
231
|
+
* @param input
|
|
232
|
+
* @returns
|
|
233
|
+
*/
|
|
234
|
+
export declare function isPast(input: Date): boolean;
|
package/src/lib/model/model.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare const DEFAULT_UNKNOWN_MODEL_TYPE_STRING: ModelTypeString;
|
|
|
20
20
|
export interface UniqueModel {
|
|
21
21
|
id?: ModelKey;
|
|
22
22
|
}
|
|
23
|
+
export type UniqueModelWithId = Required<UniqueModel>;
|
|
23
24
|
export interface TypedModel<M extends ModelTypeString = ModelTypeString> {
|
|
24
25
|
type: M;
|
|
25
26
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type MapFunction } from '../value/map';
|
|
2
2
|
import { type Maybe } from '../value/maybe.type';
|
|
3
3
|
import { type AsNumberInput } from './number';
|
|
4
|
-
export type
|
|
4
|
+
export type FloorOrCeilRounding = 'floor' | 'ceil';
|
|
5
|
+
export type NumberRounding = 'none' | FloorOrCeilRounding | 'round';
|
|
5
6
|
export type RoundingFunction = MapFunction<number, number>;
|
|
6
7
|
export declare function roundingFunction(type: NumberRounding): RoundingFunction;
|
|
7
8
|
export type RoundingInput = NumberRounding | RoundingFunction;
|
|
@@ -2,6 +2,8 @@ import { type FieldOfType } from '../key';
|
|
|
2
2
|
import { type EqualityComparatorFunction } from '../value/comparator';
|
|
3
3
|
/**
|
|
4
4
|
* Performs a deep comparison to check if all values on the input filters are equal.
|
|
5
|
+
*
|
|
6
|
+
* Recursively compares Arrays, Objects, Maps, Sets, Primatives, and Dates.
|
|
5
7
|
*/
|
|
6
8
|
export declare function areEqualPOJOValues<F>(a: F, b: F): boolean;
|
|
7
9
|
/**
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { type PageNumber, type Page } from './page';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*/
|
|
2
5
|
export interface PageCalculatorConfig {
|
|
3
6
|
pageSize: number;
|
|
4
7
|
limitKey?: string;
|
|
5
8
|
skipKey?: string;
|
|
6
9
|
}
|
|
7
10
|
/**
|
|
8
|
-
* Page
|
|
11
|
+
* Page calculation context for calculating the amount to skip/etc.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated
|
|
9
14
|
*/
|
|
10
15
|
export declare class PageCalculator {
|
|
11
16
|
readonly pageSize: number;
|
package/src/lib/page/page.d.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type FactoryWithRequiredInput } from '../getter/getter';
|
|
2
|
+
import { type Maybe } from '../value/maybe.type';
|
|
3
|
+
/**
|
|
4
|
+
* Function that uses an array of Factories to produce Promises, one after the other, to attempt to return the value.
|
|
5
|
+
*
|
|
6
|
+
* Returns a Maybe value of the expected output, and returns null if no factory/promise returns the intended value.
|
|
7
|
+
*/
|
|
8
|
+
export type TryWithPromiseFactoriesFunction<I, O> = (input: I, config?: TryWithPromiseFactoriesFunctionOptionalConfig<I, O>) => Promise<Maybe<O>>;
|
|
9
|
+
export interface TryWithPromiseFactoriesFunctionOptionalConfig<I, O> {
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not to return a Maybe value if it is returned by one of the created promises.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to false.
|
|
14
|
+
*/
|
|
15
|
+
readonly successOnMaybe?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether or not to throw errors.
|
|
18
|
+
*
|
|
19
|
+
* Defaults to false.
|
|
20
|
+
*/
|
|
21
|
+
readonly throwErrors?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface TryWithPromiseFactoriesFunctionConfig<I, O> extends TryWithPromiseFactoriesFunctionOptionalConfig<I, O> {
|
|
24
|
+
/**
|
|
25
|
+
* Factories used to create new Promise valeus to test.
|
|
26
|
+
*
|
|
27
|
+
* Promises are generated one at a time.
|
|
28
|
+
*
|
|
29
|
+
* I.E. if the first factory's generated promise returns a non-successful value or throws an error, the next promise will be generated and tried.
|
|
30
|
+
*/
|
|
31
|
+
readonly promiseFactories: FactoryWithRequiredInput<Promise<Maybe<O>>, I>[];
|
|
32
|
+
}
|
|
33
|
+
export declare function tryWithPromiseFactoriesFunction<I, O>(config: TryWithPromiseFactoriesFunctionConfig<I, O>): TryWithPromiseFactoriesFunction<I, O>;
|
package/src/lib/string/char.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export interface FirstAndLastCharacterOccurrence {
|
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
18
|
export declare function firstAndLastCharacterOccurrence(input: string, find: string): FirstAndLastCharacterOccurrence;
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if the input string contains the character (or string) to find.
|
|
21
|
+
*/
|
|
22
|
+
export declare function stringContains(input: string, find: string): boolean;
|
|
19
23
|
/**
|
|
20
24
|
* Function that replaces the last character with the configured replacement string if it is any of the configured values.
|
|
21
25
|
*/
|
|
@@ -21,6 +21,34 @@ export declare const REGEX_SPECIAL_CHARACTERS_SET: Set<string>;
|
|
|
21
21
|
* @param find
|
|
22
22
|
*/
|
|
23
23
|
export declare function findStringsRegexString(find: ArrayOrValue<string>): string;
|
|
24
|
+
export interface EscapeStringCharactersFunctionConfig {
|
|
25
|
+
/**
|
|
26
|
+
* The set of characters to find and use the escapeCharacter() function on.
|
|
27
|
+
*
|
|
28
|
+
* Targets should be individual characters. Strings of more than one character are ignored.
|
|
29
|
+
*/
|
|
30
|
+
readonly escapeTargets: Iterable<string> | Set<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Escapes the target character. Can return any string to properly "escape" the character.
|
|
33
|
+
*
|
|
34
|
+
* @param char
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
readonly escapeCharacter: (char: string) => string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Function that properly "escapes" specific characters in a string.
|
|
41
|
+
*
|
|
42
|
+
* How the characters are escaped is determined by the function.
|
|
43
|
+
*/
|
|
44
|
+
export type EscapeStringCharactersFunction = (input: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Creates an EscapeStringCharactersFunction
|
|
47
|
+
*
|
|
48
|
+
* @param config
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
export declare function escapeStringCharactersFunction(config: EscapeStringCharactersFunctionConfig): EscapeStringCharactersFunction;
|
|
24
52
|
/**
|
|
25
53
|
* Escapes the input string to be usable in a Regex value.
|
|
26
54
|
*
|
|
@@ -28,7 +56,7 @@ export declare function findStringsRegexString(find: ArrayOrValue<string>): stri
|
|
|
28
56
|
*
|
|
29
57
|
* @param input
|
|
30
58
|
*/
|
|
31
|
-
export declare
|
|
59
|
+
export declare const escapeStringForRegex: EscapeStringCharactersFunction;
|
|
32
60
|
export type FindAllCharacterOccurencesFunction = (input: string, max?: Maybe<number>) => number[];
|
|
33
61
|
export declare function findAllCharacterOccurencesFunction(characterSet: Set<string>): FindAllCharacterOccurencesFunction;
|
|
34
62
|
/**
|
package/src/lib/value/point.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface LatLngPoint {
|
|
|
22
22
|
/**
|
|
23
23
|
* A point decorated as LonLat.
|
|
24
24
|
*
|
|
25
|
-
* NOTE: This library prefers the use of LatLngPoint over LonLatPoint. This is only provided as compatability for libraries (like Mapbox) that have LonLat-like points
|
|
25
|
+
* NOTE: This library (dbx-components) prefers the use of LatLngPoint over LonLatPoint. This is only provided as compatability for libraries (like Mapbox) that have LonLat-like points
|
|
26
26
|
*/
|
|
27
27
|
export interface LonLatPoint {
|
|
28
28
|
lat: Latitude;
|
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [11.0.0](https://github.com/dereekb/dbx-components/compare/v10.2.0-dev...v11.0.0) (2024-11-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [10.2.0](https://github.com/dereekb/dbx-components/compare/v10.1.30-dev...v10.2.0) (2024-11-07)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* zoho recruit ([#26](https://github.com/dereekb/dbx-components/issues/26)) ([8e028fd](https://github.com/dereekb/dbx-components/commit/8e028fd6fc57fb276ce04d37ce010fb5a42d4157))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
## [10.1.30](https://github.com/dereekb/dbx-components/compare/v10.1.29-dev...v10.1.30) (2024-10-23)
|
|
6
19
|
|
|
7
20
|
|
package/test/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Since fail() was silently removed, we redefine it.
|
|
5
5
|
*/
|
|
6
|
-
import { PromiseReference, PromiseOrValue } from '@dereekb/util';
|
|
6
|
+
import { PromiseReference, PromiseOrValue, ClassType, Maybe, ClassLikeType } from '@dereekb/util';
|
|
7
7
|
import { BaseError } from 'make-error';
|
|
8
8
|
export interface JestDoneCallback {
|
|
9
9
|
(...args: any[]): any;
|
|
@@ -37,18 +37,37 @@ export declare function failSuccessfully(message?: string): never;
|
|
|
37
37
|
export declare class JestUnexpectedSuccessFailureError extends BaseError {
|
|
38
38
|
}
|
|
39
39
|
export declare function failDueToSuccessError(message?: string): JestUnexpectedSuccessFailureError;
|
|
40
|
+
/**
|
|
41
|
+
* Error thrown when the error type was different than the expected type.
|
|
42
|
+
*/
|
|
43
|
+
export declare class JestExpeectedErrorOfSpecificTypeError extends BaseError {
|
|
44
|
+
constructor(encounteredType: unknown, expectedType?: Maybe<ClassLikeType | string>);
|
|
45
|
+
}
|
|
40
46
|
export declare function failTest(message?: string): never;
|
|
41
47
|
export declare function failDueToSuccess(): never;
|
|
42
48
|
export declare function failWithDoneDueToSuccess(done: JestDoneCallback): void;
|
|
43
49
|
export declare function EXPECT_ERROR_DEFAULT_HANDLER(e: unknown): void;
|
|
50
|
+
/**
|
|
51
|
+
* Used to assert additional information about the expected error.
|
|
52
|
+
*
|
|
53
|
+
* Can assert within this function, or return a boolean. A boolean returning false means the test should throw a JestExpeectedErrorOfSpecificTypeError.
|
|
54
|
+
*/
|
|
55
|
+
export type JestExpectFailAssertionFunction = (error: unknown) => PromiseOrValue<Maybe<boolean> | void>;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a JestExpeectedErrorOfSpecificTypeError that asserts the encountered error is of the expected type using the instanceof keyword.
|
|
58
|
+
*
|
|
59
|
+
* @param expectedType
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
export declare function jestExpectFailAssertErrorType(expectedType: ClassType | ClassLikeType | typeof Error | any): JestExpectFailAssertionFunction;
|
|
44
63
|
/**
|
|
45
64
|
* Function that expects any failure to be thrown, then throws a JestExpectedFailError.
|
|
46
65
|
*
|
|
47
66
|
* @param errorFn
|
|
48
67
|
* @param handleError
|
|
49
68
|
*/
|
|
50
|
-
export declare function expectFail(errorFn: () => void): void;
|
|
51
|
-
export declare function expectFail(errorFn: () => Promise<void
|
|
69
|
+
export declare function expectFail(errorFn: () => void, assertFailType?: JestExpectFailAssertionFunction): void;
|
|
70
|
+
export declare function expectFail(errorFn: () => Promise<void>, assertFailType?: JestExpectFailAssertionFunction): Promise<void>;
|
|
52
71
|
/**
|
|
53
72
|
* Function that expects a JestExpectedFailError to be thrown.
|
|
54
73
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Since fail() was silently removed, we redefine it.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.fakeDoneHandler = exports.itShouldFail = exports.shouldFail = exports.expectSuccessfulFail = exports.expectFail = exports.EXPECT_ERROR_DEFAULT_HANDLER = exports.failWithDoneDueToSuccess = exports.failDueToSuccess = exports.failTest = exports.failDueToSuccessError = exports.JestUnexpectedSuccessFailureError = exports.failSuccessfully = exports.failSuccessfullyError = exports.JestExpectedFailError = exports.failWithJestDoneCallback = void 0;
|
|
8
|
+
exports.fakeDoneHandler = exports.itShouldFail = exports.shouldFail = exports.expectSuccessfulFail = exports.expectFail = exports.jestExpectFailAssertErrorType = exports.EXPECT_ERROR_DEFAULT_HANDLER = exports.failWithDoneDueToSuccess = exports.failDueToSuccess = exports.failTest = exports.JestExpeectedErrorOfSpecificTypeError = exports.failDueToSuccessError = exports.JestUnexpectedSuccessFailureError = exports.failSuccessfully = exports.failSuccessfullyError = exports.JestExpectedFailError = exports.failWithJestDoneCallback = void 0;
|
|
9
9
|
const util_1 = require("@dereekb/util");
|
|
10
10
|
const make_error_1 = require("make-error");
|
|
11
11
|
/**
|
|
@@ -44,9 +44,18 @@ class JestUnexpectedSuccessFailureError extends make_error_1.BaseError {
|
|
|
44
44
|
}
|
|
45
45
|
exports.JestUnexpectedSuccessFailureError = JestUnexpectedSuccessFailureError;
|
|
46
46
|
function failDueToSuccessError(message) {
|
|
47
|
-
return new JestUnexpectedSuccessFailureError(message
|
|
47
|
+
return new JestUnexpectedSuccessFailureError(message ?? 'expected an error to occur but was successful instead');
|
|
48
48
|
}
|
|
49
49
|
exports.failDueToSuccessError = failDueToSuccessError;
|
|
50
|
+
/**
|
|
51
|
+
* Error thrown when the error type was different than the expected type.
|
|
52
|
+
*/
|
|
53
|
+
class JestExpeectedErrorOfSpecificTypeError extends make_error_1.BaseError {
|
|
54
|
+
constructor(encounteredType, expectedType) {
|
|
55
|
+
super(`The error encountered was not of the expected type. Expected: ${expectedType ?? 'n/a'}, but encountered: ${encounteredType} `);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.JestExpeectedErrorOfSpecificTypeError = JestExpeectedErrorOfSpecificTypeError;
|
|
50
59
|
function failTest(message) {
|
|
51
60
|
throw failDueToSuccessError(message);
|
|
52
61
|
}
|
|
@@ -68,12 +77,30 @@ function EXPECT_ERROR_DEFAULT_HANDLER(e) {
|
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
79
|
exports.EXPECT_ERROR_DEFAULT_HANDLER = EXPECT_ERROR_DEFAULT_HANDLER;
|
|
71
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Creates a JestExpeectedErrorOfSpecificTypeError that asserts the encountered error is of the expected type using the instanceof keyword.
|
|
82
|
+
*
|
|
83
|
+
* @param expectedType
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
function jestExpectFailAssertErrorType(expectedType) {
|
|
87
|
+
return (error) => {
|
|
88
|
+
if (!(error instanceof expectedType)) {
|
|
89
|
+
throw new JestExpeectedErrorOfSpecificTypeError(error, expectedType);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
exports.jestExpectFailAssertErrorType = jestExpectFailAssertErrorType;
|
|
94
|
+
function expectFail(errorFn, assertFailType) {
|
|
72
95
|
function handleError(e) {
|
|
73
96
|
if (e instanceof JestUnexpectedSuccessFailureError) {
|
|
74
97
|
throw e;
|
|
75
98
|
}
|
|
76
99
|
else {
|
|
100
|
+
const assertionResult = assertFailType?.(e);
|
|
101
|
+
if (assertionResult === false) {
|
|
102
|
+
throw new JestExpeectedErrorOfSpecificTypeError(e);
|
|
103
|
+
}
|
|
77
104
|
failSuccessfully();
|
|
78
105
|
}
|
|
79
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.fail.js","sourceRoot":"","sources":["../../../../../../packages/util/test/src/lib/jest.fail.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"jest.fail.js","sourceRoot":"","sources":["../../../../../../packages/util/test/src/lib/jest.fail.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,wCAAgJ;AAChJ,2CAAoD;AAapD;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,IAAsB,EAAE,IAAa,IAAI,KAAK,CAAC,aAAa,CAAC;IACpG,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;QACrB,IAAI,CAAC,IAAI,CAAC,CAAU,CAAC,CAAC;KACvB;SAAM;QACL,IAAI,CAAC,CAAC,CAAC,CAAC;KACT;AACH,CAAC;AAND,4DAMC;AAKD,eAAe;AACf;;GAEG;AACH,MAAa,qBAAsB,SAAQ,sBAAS;CAAG;AAAvD,sDAAuD;AAEvD,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAFD,sDAEC;AAED,SAAgB,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAFD,4CAEC;AAED;;GAEG;AACH,MAAa,iCAAkC,SAAQ,sBAAS;CAAG;AAAnE,8EAAmE;AAEnE,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO,IAAI,iCAAiC,CAAC,OAAO,IAAI,uDAAuD,CAAC,CAAC;AACnH,CAAC;AAFD,sDAEC;AAED;;GAEG;AACH,MAAa,qCAAsC,SAAQ,sBAAS;IAClE,YAAY,eAAwB,EAAE,YAA4C;QAChF,KAAK,CAAC,iEAAiE,YAAY,IAAI,KAAK,sBAAsB,eAAe,GAAG,CAAC,CAAC;IACxI,CAAC;CACF;AAJD,sFAIC;AAED,SAAgB,QAAQ,CAAC,OAAgB;IACvC,MAAM,qBA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QAAQ,CAAC,IAAI,GAAG,UAAU,CAAC;IAC3B,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACtC,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACtC,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAEpC,OAAO,QAA+B,CAAC;AACzC,CAAC;AA1BD,0CA0BC"}
|
package/test/src/lib/jest.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useJestContextFixture = exports.jestTestContextBuilder = exports.AbstractChildJestTestContextFixture = exports.AbstractJestTestContextFixture = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
/**
|
|
6
5
|
* Abstract JestTestContextFixture instance.
|
|
7
6
|
*/
|
|
8
7
|
class AbstractJestTestContextFixture {
|
|
8
|
+
_instance;
|
|
9
9
|
get instance() {
|
|
10
10
|
return this._instance;
|
|
11
11
|
}
|
|
@@ -24,6 +24,7 @@ exports.AbstractJestTestContextFixture = AbstractJestTestContextFixture;
|
|
|
24
24
|
* Abstract JestTestContextFixture instance with a parent.
|
|
25
25
|
*/
|
|
26
26
|
class AbstractChildJestTestContextFixture extends AbstractJestTestContextFixture {
|
|
27
|
+
parent;
|
|
27
28
|
constructor(parent) {
|
|
28
29
|
super();
|
|
29
30
|
this.parent = parent;
|
|
@@ -73,9 +74,9 @@ function useJestContextFixture(config) {
|
|
|
73
74
|
let clearInstance;
|
|
74
75
|
let instance;
|
|
75
76
|
// Create an instance
|
|
76
|
-
beforeEach(() =>
|
|
77
|
+
beforeEach(async () => {
|
|
77
78
|
try {
|
|
78
|
-
instance =
|
|
79
|
+
instance = await initInstance();
|
|
79
80
|
clearInstance = fixture.setInstance(instance);
|
|
80
81
|
}
|
|
81
82
|
catch (e) {
|
|
@@ -85,11 +86,11 @@ function useJestContextFixture(config) {
|
|
|
85
86
|
}
|
|
86
87
|
throw e;
|
|
87
88
|
}
|
|
88
|
-
})
|
|
89
|
+
});
|
|
89
90
|
// Declare tests
|
|
90
91
|
buildTests(fixture);
|
|
91
92
|
// Cleanup
|
|
92
|
-
afterEach(() =>
|
|
93
|
+
afterEach(async () => {
|
|
93
94
|
if (clearInstance) {
|
|
94
95
|
clearInstance();
|
|
95
96
|
}
|
|
@@ -98,7 +99,7 @@ function useJestContextFixture(config) {
|
|
|
98
99
|
}
|
|
99
100
|
if (destroyInstance) {
|
|
100
101
|
try {
|
|
101
|
-
|
|
102
|
+
await destroyInstance(instance);
|
|
102
103
|
instance = undefined;
|
|
103
104
|
}
|
|
104
105
|
catch (e) {
|
|
@@ -106,7 +107,7 @@ function useJestContextFixture(config) {
|
|
|
106
107
|
throw e;
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
})
|
|
110
|
+
});
|
|
110
111
|
}
|
|
111
112
|
exports.useJestContextFixture = useJestContextFixture;
|
|
112
113
|
//# sourceMappingURL=jest.js.map
|
package/test/src/lib/jest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../../../../../../packages/util/test/src/lib/jest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../../../../../../packages/util/test/src/lib/jest.ts"],"names":[],"mappings":";;;AAkCA;;GAEG;AACH,MAAsB,8BAA8B;IAC1C,SAAS,CAAK;IAEtB,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAU,CAAC;IACzB,CAAC;IAED,WAAW,CAAC,QAAW;QACrB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACtF;QAED,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,OAAO,GAAG,EAAE;YACV,OAAO,IAAI,CAAC,SAAS,CAAC;Q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,qBAAqB;IACrB,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,IAAI;YACF,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;YAChC,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SAC/C;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,6EAA6E,EAAE,CAAC,CAAC,CAAC;YAEhG,IAAI,aAAa,EAAE;gBACjB,aAAa,EAAE,CAAC;aACjB;YAED,MAAM,CAAC,CAAC;SACT;IACH,CAAC,CAAC,CAAC;IAEH,gBAAgB;IAChB,UAAU,CAAC,OAAO,CAAC,CAAC;IAEpB,UAAU;IACV,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,IAAI,aAAa,EAAE;YACjB,aAAa,EAAE,CAAC;SACjB;QAED,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;YAC5B,OAAO,CAAC,IAAI,CAAC,mFAAmF,CAAC,CAAC;SACnG;QAED,IAAI,eAAe,EAAE;YACnB,IAAI;gBACF,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;gBAChC,QAAQ,GAAG,SAAgB,CAAC;aAC7B;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;gBAC1D,MAAM,CAAC,CAAC;aACT;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA7CD,sDA6CC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.instanceWrapJestTestContextFactory = exports.wrapJestTestContextFactory = exports.AbstractWrappedFixtureWithInstance = exports.AbstractWrappedFixture = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const jest_1 = require("./jest");
|
|
6
5
|
class AbstractWrappedFixture {
|
|
6
|
+
fixture;
|
|
7
7
|
constructor(fixture) {
|
|
8
8
|
this.fixture = fixture;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.AbstractWrappedFixture = AbstractWrappedFixture;
|
|
12
12
|
class AbstractWrappedFixtureWithInstance extends jest_1.AbstractJestTestContextFixture {
|
|
13
|
+
parent;
|
|
13
14
|
constructor(parent) {
|
|
14
15
|
super();
|
|
15
16
|
this.parent = parent;
|
|
@@ -29,17 +30,17 @@ function wrapJestTestContextFactory(config) {
|
|
|
29
30
|
let effect;
|
|
30
31
|
// add before each
|
|
31
32
|
if (config.setupWrap != null) {
|
|
32
|
-
beforeEach(() =>
|
|
33
|
-
effect =
|
|
34
|
-
})
|
|
33
|
+
beforeEach(async () => {
|
|
34
|
+
effect = await config.setupWrap(wrap);
|
|
35
|
+
});
|
|
35
36
|
}
|
|
36
37
|
// add tests
|
|
37
38
|
buildTests(wrap);
|
|
38
39
|
// add after each
|
|
39
40
|
if (config.teardownWrap != null) {
|
|
40
|
-
afterEach(() =>
|
|
41
|
-
|
|
42
|
-
})
|
|
41
|
+
afterEach(async () => {
|
|
42
|
+
await config.teardownWrap(wrap, effect);
|
|
43
|
+
});
|
|
43
44
|
}
|
|
44
45
|
});
|
|
45
46
|
};
|
|
@@ -49,20 +50,20 @@ exports.wrapJestTestContextFactory = wrapJestTestContextFactory;
|
|
|
49
50
|
function instanceWrapJestTestContextFactory(config) {
|
|
50
51
|
return wrapJestTestContextFactory({
|
|
51
52
|
wrapFixture: config.wrapFixture,
|
|
52
|
-
setupWrap: (wrap) =>
|
|
53
|
-
const instance =
|
|
53
|
+
setupWrap: async (wrap) => {
|
|
54
|
+
const instance = await config.makeInstance(wrap);
|
|
54
55
|
const effect = wrap.setInstance(instance);
|
|
55
56
|
if (config.setupInstance) {
|
|
56
|
-
|
|
57
|
+
await config.setupInstance(instance, wrap);
|
|
57
58
|
}
|
|
58
59
|
return effect;
|
|
59
|
-
}
|
|
60
|
-
teardownWrap: (wrap, deleteInstanceEffect) =>
|
|
61
|
-
deleteInstanceEffect
|
|
60
|
+
},
|
|
61
|
+
teardownWrap: async (wrap, deleteInstanceEffect) => {
|
|
62
|
+
deleteInstanceEffect?.();
|
|
62
63
|
if (config.teardownInstance) {
|
|
63
|
-
|
|
64
|
+
await config.teardownInstance(wrap.instance);
|
|
64
65
|
}
|
|
65
|
-
}
|
|
66
|
+
}
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
exports.instanceWrapJestTestContextFactory = instanceWrapJestTestContextFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.wrap.js","sourceRoot":"","sources":["../../../../../../packages/util/test/src/lib/jest.wrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jest.wrap.js","sourceRoot":"","sources":["../../../../../../packages/util/test/src/lib/jest.wrap.ts"],"names":[],"mappings":";;;AAAA,iCAAgK;AAEhK,MAAsB,sBAAsB;IACrB;IAArB,YAAqB,OAAU;QAAV,YAAO,GAAP,OAAO,CAAG;IAAG,CAAC;CACpC;AAFD,wDAEC;AAED,MAAsB,kCAAyC,SAAQ,qCAAiC;IACjF;IAArB,YAAqB,MAAS;QAC5B,KAAK,EAAE,CAAC;QADW,WAAM,GAAN,MAAM,CAAG;IAE9B,CAAC;CACF;AAJD,gFAIC;AAiCD;;;;GAIG;AACH,SAAgB,0BAA0B,CAAgB,MAA0C;IAClG,OAAO,CAAC,OAAkC,EAAE,EAAE;QAC5C,OAAO,CAAC,UAAgD,EAAE,EAAE;YAC1D,OAAO,CAAC,CAAC,YAAe,EAAE,EAAE;gBAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;gBAC9C,IAAI,MAAS,CAAC;gBAEd,kBAAkB;gBAClB,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,EAAE;oBAC5B,UAAU,CAAC,KAAK,IAAI,EAAE;wBACpB,MAAM,GAAG,MAAM,MAAM,CAAC,SAAU,CAAC,IAAI,CAAC,CAAC;oBACzC,CAAC,CA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