@nestia/e2e 0.1.6 → 0.1.7
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/TestValidator.d.ts +19 -7
- package/lib/TestValidator.js +31 -12
- package/lib/TestValidator.js.map +1 -1
- package/package.json +56 -52
- package/src/TestValidator.ts +38 -13
package/lib/TestValidator.d.ts
CHANGED
|
@@ -7,22 +7,34 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare namespace TestValidator {
|
|
9
9
|
/**
|
|
10
|
-
* Test whether
|
|
11
|
-
*
|
|
12
|
-
* If error occurs, nothing would be happened.
|
|
13
|
-
*
|
|
14
|
-
* However, no error exists, then exception would be thrown.
|
|
10
|
+
* Test whether condition is satisfied.
|
|
15
11
|
*
|
|
16
|
-
* @param title Title of
|
|
12
|
+
* @param title Title of error message when condition is not satisfied
|
|
13
|
+
* @return Currying function
|
|
17
14
|
*/
|
|
18
|
-
const
|
|
15
|
+
const predicate: (title: string) => (condition: () => boolean) => void;
|
|
19
16
|
/**
|
|
20
17
|
* Test whether two values are equal.
|
|
21
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
|
+
*
|
|
22
24
|
* @param title Title of error message when different
|
|
23
25
|
* @returns Currying function
|
|
24
26
|
*/
|
|
25
27
|
const equals: (title: string) => <T>(x: T) => (y: T) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Test whether error occurs.
|
|
30
|
+
*
|
|
31
|
+
* If error occurs, nothing would be happened.
|
|
32
|
+
*
|
|
33
|
+
* However, no error exists, then exception would be thrown.
|
|
34
|
+
*
|
|
35
|
+
* @param title Title of exception because of no error exists
|
|
36
|
+
*/
|
|
37
|
+
const error: (title: string) => (task: () => any | Promise<any>) => Promise<void>;
|
|
26
38
|
/**
|
|
27
39
|
* Validate index API.
|
|
28
40
|
*
|
package/lib/TestValidator.js
CHANGED
|
@@ -49,8 +49,8 @@ var __values = (this && this.__values) || function(o) {
|
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.TestValidator = void 0;
|
|
51
51
|
var ranges_1 = require("tstl/ranges");
|
|
52
|
-
var json_equal_to_1 = require("./internal/json_equal_to");
|
|
53
52
|
var RandomGenerator_1 = require("./RandomGenerator");
|
|
53
|
+
var json_equal_to_1 = require("./internal/json_equal_to");
|
|
54
54
|
/**
|
|
55
55
|
* Test validator.
|
|
56
56
|
*
|
|
@@ -61,6 +61,36 @@ var RandomGenerator_1 = require("./RandomGenerator");
|
|
|
61
61
|
var TestValidator;
|
|
62
62
|
(function (TestValidator) {
|
|
63
63
|
var _this = this;
|
|
64
|
+
/**
|
|
65
|
+
* Test whether condition is satisfied.
|
|
66
|
+
*
|
|
67
|
+
* @param title Title of error message when condition is not satisfied
|
|
68
|
+
* @return Currying function
|
|
69
|
+
*/
|
|
70
|
+
TestValidator.predicate = function (title) { return function (condition) {
|
|
71
|
+
if (condition() !== true)
|
|
72
|
+
throw new Error("Bug on ".concat(title, ": expected condition is not satisfied."));
|
|
73
|
+
}; };
|
|
74
|
+
/**
|
|
75
|
+
* Test whether two values are equal.
|
|
76
|
+
*
|
|
77
|
+
* If you want to validate `covers` relationship,
|
|
78
|
+
* call smaller first and then larger.
|
|
79
|
+
*
|
|
80
|
+
* Otherwise you wanna non equals validator, combine with {@link error}.
|
|
81
|
+
*
|
|
82
|
+
* @param title Title of error message when different
|
|
83
|
+
* @returns Currying function
|
|
84
|
+
*/
|
|
85
|
+
TestValidator.equals = function (title) {
|
|
86
|
+
return function (x) {
|
|
87
|
+
return function (y) {
|
|
88
|
+
var diff = (0, json_equal_to_1.json_equal_to)(x, y);
|
|
89
|
+
if (diff.length)
|
|
90
|
+
throw new Error("Bug on ".concat(title, ": found different values - [").concat(diff.join(", "), "]"));
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
64
94
|
/**
|
|
65
95
|
* Test whether error occurs.
|
|
66
96
|
*
|
|
@@ -89,17 +119,6 @@ var TestValidator;
|
|
|
89
119
|
});
|
|
90
120
|
}); };
|
|
91
121
|
};
|
|
92
|
-
/**
|
|
93
|
-
* Test whether two values are equal.
|
|
94
|
-
*
|
|
95
|
-
* @param title Title of error message when different
|
|
96
|
-
* @returns Currying function
|
|
97
|
-
*/
|
|
98
|
-
TestValidator.equals = function (title) { return function (x) { return function (y) {
|
|
99
|
-
var diff = (0, json_equal_to_1.json_equal_to)(x, y);
|
|
100
|
-
if (diff.length)
|
|
101
|
-
throw new Error("Bug on ".concat(title, ": found different values - [").concat(diff.join(", "), "]"));
|
|
102
|
-
}; }; };
|
|
103
122
|
/**
|
|
104
123
|
* Validate index API.
|
|
105
124
|
*
|
package/lib/TestValidator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestValidator.js","sourceRoot":"","sources":["../src/TestValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAwC;
|
|
1
|
+
{"version":3,"file":"TestValidator.js","sourceRoot":"","sources":["../src/TestValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAwC;AAExC,qDAAoD;AACpD,0DAAyD;AAEzD;;;;;;GAMG;AACH,IAAiB,aAAa,CA4N7B;AA5ND,WAAiB,aAAa;;IAC1B;;;;;OAKG;IACU,uBAAS,GAAG,UAAC,KAAa,IAAK,OAAA,UAAC,SAAwB;QACjE,IAAI,SAAS,EAAE,KAAK,IAAI;YACpB,MAAM,IAAI,KAAK,CACX,iBAAU,KAAK,2CAAwC,CAC1D,CAAC;IACV,CAAC,EAL2C,CAK3C,CAAC;IAEF;;;;;;;;;;OAUG;IACU,oBAAM,GACf,UAAC,KAAa;QACd,OAAA,UAAI,CAA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AC,IAAI,IAAK,OAAC,IAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAxB,CAAwB,CAAC,CAAC,CAAC;4CAC9D,MAAM,IAAI,KAAK,CACX,iBAAU,KAAK,gCAAsB,SAAS,cAAI,MAAM,CAAC,IAAI,CACzD,IAAI,CACP,OAAI,CACR,CAAC;yCACL;;;;;qBACJ;gBAxBD,CAwBC;YA5BD,CA4BC;QAjCD,CAiCC;IA3CD,CA2CC,CAAC;AAKV,CAAC,EA5NgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA4N7B;AAMD,SAAS,OAAO,CAA8B,QAAkB;IAC5D,OAAO,QAAQ,CAAC,GAAG,CAAC,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,EAAE,EAAT,CAAS,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAhB,CAAgB,CAAC,CAAC;AAChF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,52 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nestia/e2e",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "E2E test utilify functions",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "rimraf lib && tsc",
|
|
8
|
-
"dev": "npm run build -- --watch",
|
|
9
|
-
"prettier": "prettier --write ./src/**/*.ts",
|
|
10
|
-
"test": "node lib/test"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"@
|
|
33
|
-
"@types/
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@nestia/e2e",
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "E2E test utilify functions",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rimraf lib && tsc",
|
|
8
|
+
"dev": "npm run build -- --watch",
|
|
9
|
+
"prettier": "prettier --write ./src/**/*.ts",
|
|
10
|
+
"test": "node lib/test",
|
|
11
|
+
"prepare": "ts-patch install"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/samchon/nestia"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"e2e",
|
|
19
|
+
"nestia",
|
|
20
|
+
"nestjs",
|
|
21
|
+
"test",
|
|
22
|
+
"tdd",
|
|
23
|
+
"utility"
|
|
24
|
+
],
|
|
25
|
+
"author": "Jeongho Nam",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/samchon/nestia/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/samchon/nestia#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
|
|
33
|
+
"@types/cli": "^0.11.21",
|
|
34
|
+
"@types/node": "^18.11.18",
|
|
35
|
+
"prettier": "^2.8.3",
|
|
36
|
+
"rimraf": "^4.1.2",
|
|
37
|
+
"ts-node": "^10.9.1",
|
|
38
|
+
"ts-patch": "^2.1.0",
|
|
39
|
+
"typescript": "^4.9.5",
|
|
40
|
+
"typia": "^3.6.9"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"chalk": "^4.1.2",
|
|
44
|
+
"cli": "^1.0.1",
|
|
45
|
+
"tstl": "^2.5.13"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"lib",
|
|
49
|
+
"src",
|
|
50
|
+
"!lib/test",
|
|
51
|
+
"!src/test",
|
|
52
|
+
"README.md",
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"package.json"
|
|
55
|
+
]
|
|
56
|
+
}
|
package/src/TestValidator.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { is_sorted } from "tstl/ranges";
|
|
2
|
-
import { json_equal_to } from "./internal/json_equal_to";
|
|
3
2
|
|
|
4
3
|
import { RandomGenerator } from "./RandomGenerator";
|
|
4
|
+
import { json_equal_to } from "./internal/json_equal_to";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Test validator.
|
|
@@ -11,6 +11,43 @@ import { RandomGenerator } from "./RandomGenerator";
|
|
|
11
11
|
* @author Jeongho Nam - https://github.com/samchon
|
|
12
12
|
*/
|
|
13
13
|
export namespace TestValidator {
|
|
14
|
+
/**
|
|
15
|
+
* Test whether condition is satisfied.
|
|
16
|
+
*
|
|
17
|
+
* @param title Title of error message when condition is not satisfied
|
|
18
|
+
* @return Currying function
|
|
19
|
+
*/
|
|
20
|
+
export const predicate = (title: string) => (condition: () => boolean) => {
|
|
21
|
+
if (condition() !== true)
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Bug on ${title}: expected condition is not satisfied.`,
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Test whether two values are equal.
|
|
29
|
+
*
|
|
30
|
+
* If you want to validate `covers` relationship,
|
|
31
|
+
* call smaller first and then larger.
|
|
32
|
+
*
|
|
33
|
+
* Otherwise you wanna non equals validator, combine with {@link error}.
|
|
34
|
+
*
|
|
35
|
+
* @param title Title of error message when different
|
|
36
|
+
* @returns Currying function
|
|
37
|
+
*/
|
|
38
|
+
export const equals =
|
|
39
|
+
(title: string) =>
|
|
40
|
+
<T>(x: T) =>
|
|
41
|
+
(y: T) => {
|
|
42
|
+
const diff: string[] = json_equal_to(x, y);
|
|
43
|
+
if (diff.length)
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Bug on ${title}: found different values - [${diff.join(
|
|
46
|
+
", ",
|
|
47
|
+
)}]`,
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
14
51
|
/**
|
|
15
52
|
* Test whether error occurs.
|
|
16
53
|
*
|
|
@@ -31,18 +68,6 @@ export namespace TestValidator {
|
|
|
31
68
|
throw new Error(`Bug on ${title}: exception must be thrown.`);
|
|
32
69
|
};
|
|
33
70
|
|
|
34
|
-
/**
|
|
35
|
-
* Test whether two values are equal.
|
|
36
|
-
*
|
|
37
|
-
* @param title Title of error message when different
|
|
38
|
-
* @returns Currying function
|
|
39
|
-
*/
|
|
40
|
-
export const equals = (title: string) => <T>(x: T) => (y: T) => {
|
|
41
|
-
const diff: string[] = json_equal_to(x, y);
|
|
42
|
-
if (diff.length)
|
|
43
|
-
throw new Error(`Bug on ${title}: found different values - [${diff.join(", ")}]`);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
71
|
/**
|
|
47
72
|
* Validate index API.
|
|
48
73
|
*
|