@nestia/e2e 0.3.1 → 0.3.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/lib/ArrayUtil.d.ts +15 -15
- package/lib/ArrayUtil.js +226 -226
- package/lib/ArrayUtil.js.map +1 -1
- package/lib/DynamicExecutor.d.ts +137 -137
- package/lib/DynamicExecutor.js +355 -356
- package/lib/DynamicExecutor.js.map +1 -1
- package/lib/GaffComparator.d.ts +33 -33
- package/lib/GaffComparator.js +67 -67
- package/lib/GaffComparator.js.map +1 -1
- package/lib/RandomGenerator.d.ts +82 -82
- package/lib/RandomGenerator.js +173 -173
- package/lib/RandomGenerator.js.map +1 -1
- package/lib/StopWatch.d.ts +24 -24
- package/lib/StopWatch.js +88 -88
- package/lib/StopWatch.js.map +1 -1
- package/lib/TestValidator.d.ts +88 -87
- package/lib/TestValidator.js +382 -375
- package/lib/TestValidator.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +31 -31
- package/lib/internal/json_equal_to.d.ts +1 -1
- package/lib/internal/json_equal_to.js +72 -35
- package/lib/internal/json_equal_to.js.map +1 -1
- package/lib/module.d.ts +6 -6
- package/lib/module.js +22 -22
- package/package.json +4 -4
- package/src/TestValidator.ts +15 -5
- package/src/internal/json_equal_to.ts +35 -36
package/lib/TestValidator.d.ts
CHANGED
|
@@ -1,87 +1,88 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test validator.
|
|
3
|
-
*
|
|
4
|
-
* `TestValidator` is a collection gathering E2E validation functions.
|
|
5
|
-
*
|
|
6
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
7
|
-
*/
|
|
8
|
-
export declare namespace TestValidator {
|
|
9
|
-
/**
|
|
10
|
-
* Test whether condition is satisfied.
|
|
11
|
-
*
|
|
12
|
-
* @param title Title of error message when condition is not satisfied
|
|
13
|
-
* @return Currying function
|
|
14
|
-
*/
|
|
15
|
-
const predicate: (title: string) => <T extends boolean | (() => boolean) | (() => Promise<boolean>)>(condition: T) => T extends () => Promise<boolean> ? Promise<void> : void;
|
|
16
|
-
/**
|
|
17
|
-
* Test whether two values are equal.
|
|
18
|
-
*
|
|
19
|
-
* If you want to validate `covers` relationship,
|
|
20
|
-
* call smaller first and then larger.
|
|
21
|
-
*
|
|
22
|
-
* Otherwise you wanna non equals validator, combine with {@link error}.
|
|
23
|
-
*
|
|
24
|
-
* @param title Title of error message when different
|
|
25
|
-
* @
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* @
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Test validator.
|
|
3
|
+
*
|
|
4
|
+
* `TestValidator` is a collection gathering E2E validation functions.
|
|
5
|
+
*
|
|
6
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
7
|
+
*/
|
|
8
|
+
export declare namespace TestValidator {
|
|
9
|
+
/**
|
|
10
|
+
* Test whether condition is satisfied.
|
|
11
|
+
*
|
|
12
|
+
* @param title Title of error message when condition is not satisfied
|
|
13
|
+
* @return Currying function
|
|
14
|
+
*/
|
|
15
|
+
const predicate: (title: string) => <T extends boolean | (() => boolean) | (() => Promise<boolean>)>(condition: T) => T extends () => Promise<boolean> ? Promise<void> : void;
|
|
16
|
+
/**
|
|
17
|
+
* Test whether two values are equal.
|
|
18
|
+
*
|
|
19
|
+
* If you want to validate `covers` relationship,
|
|
20
|
+
* call smaller first and then larger.
|
|
21
|
+
*
|
|
22
|
+
* Otherwise you wanna non equals validator, combine with {@link error}.
|
|
23
|
+
*
|
|
24
|
+
* @param title Title of error message when different
|
|
25
|
+
* @param exception Exception filter for ignoring some keys
|
|
26
|
+
* @returns Currying function
|
|
27
|
+
*/
|
|
28
|
+
const equals: (title: string, exception?: (key: string) => boolean) => <T>(x: T) => (y: T) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Test whether error occurs.
|
|
31
|
+
*
|
|
32
|
+
* If error occurs, nothing would be happened.
|
|
33
|
+
*
|
|
34
|
+
* However, no error exists, then exception would be thrown.
|
|
35
|
+
*
|
|
36
|
+
* @param title Title of exception because of no error exists
|
|
37
|
+
*/
|
|
38
|
+
const error: (title: string) => <T>(task: () => T) => T extends Promise<any> ? Promise<void> : void;
|
|
39
|
+
const httpError: (title: string) => (status: number) => <T>(task: () => T) => T extends Promise<any> ? Promise<void> : void;
|
|
40
|
+
/**
|
|
41
|
+
* Validate index API.
|
|
42
|
+
*
|
|
43
|
+
* Test whether two indexed values are equal.
|
|
44
|
+
*
|
|
45
|
+
* If two values are different, then exception would be thrown.
|
|
46
|
+
*
|
|
47
|
+
* @param title Title of error message when different
|
|
48
|
+
* @return Currying function
|
|
49
|
+
*
|
|
50
|
+
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_search.ts
|
|
51
|
+
*/
|
|
52
|
+
const index: (title: string) => <Solution extends IEntity<any>>(expected: Solution[]) => <Summary extends IEntity<any>>(gotten: Summary[], trace?: boolean) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Valiate search options.
|
|
55
|
+
*
|
|
56
|
+
* Test a pagination API supporting search options.
|
|
57
|
+
*
|
|
58
|
+
* @param title Title of error message when searching is invalid
|
|
59
|
+
* @returns Currying function
|
|
60
|
+
*
|
|
61
|
+
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_search.ts
|
|
62
|
+
*/
|
|
63
|
+
const search: (title: string) => <Entity extends IEntity<any>, Request_1>(getter: (input: Request_1) => Promise<Entity[]>) => (total: Entity[], sampleCount?: number) => <Values extends any[]>(props: ISearchProps<Entity, Values, Request_1>) => Promise<void>;
|
|
64
|
+
interface ISearchProps<Entity extends IEntity<any>, Values extends any[], Request> {
|
|
65
|
+
fields: string[];
|
|
66
|
+
values(entity: Entity): Values;
|
|
67
|
+
filter(entity: Entity, values: Values): boolean;
|
|
68
|
+
request(values: Values): Request;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Validate sorting options.
|
|
72
|
+
*
|
|
73
|
+
* Test a pagination API supporting sorting options.
|
|
74
|
+
*
|
|
75
|
+
* You can validate detailed sorting options both asceding and descending orders
|
|
76
|
+
* with multiple fields. However, as it forms a complicate currying function,
|
|
77
|
+
* I recomend you to see below example code before using.
|
|
78
|
+
*
|
|
79
|
+
* @param title Title of error message when sorting is invalid
|
|
80
|
+
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_sort.ts
|
|
81
|
+
*/
|
|
82
|
+
const sort: (title: string) => <T extends object, Fields extends string, Sortable_1 extends (`-${Fields}` | `+${Fields}`)[]>(getter: (sortable: Sortable_1) => Promise<T[]>) => (...fields: Fields[]) => (comp: (x: T, y: T) => number, filter?: ((elem: T) => boolean) | undefined) => (direction: "+" | "-", trace?: boolean) => Promise<void>;
|
|
83
|
+
type Sortable<Literal extends string> = Array<`-${Literal}` | `+${Literal}`>;
|
|
84
|
+
}
|
|
85
|
+
interface IEntity<Type extends string | number | bigint> {
|
|
86
|
+
id: Type;
|
|
87
|
+
}
|
|
88
|
+
export {};
|