@nestia/e2e 0.7.0 → 0.8.1
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/README.md +39 -21
- package/lib/ArrayUtil.js +2 -2
- package/lib/DynamicExecutor.d.ts +17 -2
- package/lib/DynamicExecutor.js +136 -84
- package/lib/DynamicExecutor.js.map +1 -1
- package/lib/RandomGenerator.d.ts +2 -2
- package/lib/RandomGenerator.js +4 -4
- package/lib/RandomGenerator.js.map +1 -1
- package/lib/TestValidator.d.ts +2 -2
- package/lib/TestValidator.js +4 -4
- package/lib/index.js +17 -7
- package/lib/index.js.map +1 -1
- package/package.json +53 -53
- package/src/DynamicExecutor.ts +55 -25
- package/src/RandomGenerator.ts +3 -3
- package/src/TestValidator.ts +2 -2
package/README.md
CHANGED
|
@@ -2,21 +2,28 @@
|
|
|
2
2
|

|
|
3
3
|
|
|
4
4
|
[](https://github.com/samchon/nestia/blob/master/LICENSE)
|
|
5
|
-
[](https://www.npmjs.com/package/@nestia/fetcher)
|
|
6
|
+
[](https://www.npmjs.com/package/@nestia/fetcher)
|
|
7
7
|
[](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
|
|
8
|
-
[](https://nestia.io/docs/)
|
|
9
|
+
[](https://gurubase.io/g/nestia)
|
|
10
|
+
[](https://discord.gg/E94XhzrUCZ)
|
|
9
11
|
|
|
10
12
|
Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
11
13
|
|
|
12
|
-
- `@nestia/core`:
|
|
14
|
+
- `@nestia/core`:
|
|
15
|
+
- Super-fast/easy decorators
|
|
16
|
+
- Advanced WebSocket routes
|
|
13
17
|
- `@nestia/sdk`:
|
|
14
|
-
- Swagger generator evolved than ever
|
|
18
|
+
- Swagger generator, more evolved than ever
|
|
15
19
|
- SDK library generator for clients
|
|
16
20
|
- Mockup Simulator for client applications
|
|
17
21
|
- Automatic E2E test functions generator
|
|
18
|
-
- `@nestia/
|
|
19
|
-
-
|
|
22
|
+
- `@nestia/e2e`: Test program utilizing e2e test functions
|
|
23
|
+
- `@nestia/benchmark`: Benchmark program using e2e test functions
|
|
24
|
+
- `@nestia/chat`: Super A.I. Chatbot by Swagger document
|
|
25
|
+
- `@nestia/editor`: Swagger-UI with Online TypeScript Editor
|
|
26
|
+
- `nestia`: Just CLI (command line interface) tool
|
|
20
27
|
|
|
21
28
|
> [!NOTE]
|
|
22
29
|
>
|
|
@@ -25,8 +32,8 @@ Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
|
25
32
|
> - Runtime validator is **20,000x faster** than `class-validator`
|
|
26
33
|
> - JSON serialization is **200x faster** than `class-transformer`
|
|
27
34
|
> - Software Development Kit
|
|
28
|
-
> -
|
|
29
|
-
> - Mockup simulator means embedded backend simulator in SDK
|
|
35
|
+
> - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
|
|
36
|
+
> - Mockup simulator means embedded backend simulator in the SDK
|
|
30
37
|
> - similar with [msw](https://mswjs.io/), but fully automated
|
|
31
38
|
|
|
32
39
|

|
|
@@ -56,19 +63,30 @@ Check out the document in the [website](https://nestia.io/docs/):
|
|
|
56
63
|
|
|
57
64
|
### 📖 Features
|
|
58
65
|
- Core Library
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [
|
|
64
|
-
- [
|
|
65
|
-
|
|
66
|
-
- [
|
|
67
|
-
|
|
68
|
-
- [
|
|
69
|
-
- [Mockup Simulator](https://nestia.io/docs/sdk/
|
|
70
|
-
|
|
66
|
+
- [`@WebSocketRoute`](https://nestia.io/docs/core/WebSocketRoute)
|
|
67
|
+
- [`@TypedRoute`](https://nestia.io/docs/core/TypedRoute/)
|
|
68
|
+
- [**`@TypedBody`**](https://nestia.io/docs/core/TypedBody/)
|
|
69
|
+
- [`@TypedParam`](https://nestia.io/docs/core/TypedParam/)
|
|
70
|
+
- [`@TypedQuery`](https://nestia.io/docs/core/TypedQuery/)
|
|
71
|
+
- [`@TypedFormData`](https://nestia.io/docs/core/TypedFormData/)
|
|
72
|
+
- [`@TypedHeaders`](https://nestia.io/docs/core/TypedHeaders/)
|
|
73
|
+
- [`@TypedException`](https://nestia.io/docs/core/TypedException/)
|
|
74
|
+
- Software Development Kit
|
|
75
|
+
- [SDK Builder](https://nestia.io/docs/sdk/)
|
|
76
|
+
- [Mockup Simulator](https://nestia.io/docs/sdk/simulate/)
|
|
77
|
+
- [E2E Test Functions](https://nestia.io/docs/sdk/e2e/)
|
|
78
|
+
- [Distribution](https://nestia.io/docs/sdk/distribute/)
|
|
79
|
+
- Swagger Document
|
|
80
|
+
- [Swagger Builder](https://nestia.io/docs/swagger/)
|
|
81
|
+
- [**AI Chatbot Development**](https://nestia.io/docs/swagger/chat/)
|
|
82
|
+
- [Cloud Swagger Editor](https://nestia.io/docs/swagger/editor/)
|
|
83
|
+
- [Documentation Strategy](https://nestia.io/docs/swagger/strategy/)
|
|
84
|
+
- E2E Testing
|
|
85
|
+
- [Why E2E Test?](https://nestia.io/docs/e2e/why/)
|
|
86
|
+
- [Test Program Development](https://nestia.io/docs/e2e/development/)
|
|
87
|
+
- [Performance Benchmark](https://nestia.io/docs/e2e/benchmark/)
|
|
71
88
|
|
|
72
89
|
### 🔗 Appendix
|
|
90
|
+
- [API Documents](https://nestia.io/api)
|
|
73
91
|
- [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
|
|
74
92
|
- [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
|
package/lib/ArrayUtil.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
package/lib/DynamicExecutor.d.ts
CHANGED
|
@@ -76,7 +76,18 @@ export declare namespace DynamicExecutor {
|
|
|
76
76
|
* @param parameters Parameters, result of options.parameters function.
|
|
77
77
|
* @returns Wrapper function
|
|
78
78
|
*/
|
|
79
|
-
wrapper?: (name: string, closure: Closure<Parameters, Ret>,
|
|
79
|
+
wrapper?: (name: string, closure: Closure<Parameters, Ret>, parameters: Parameters) => Promise<any>;
|
|
80
|
+
/**
|
|
81
|
+
* Number of simultaneous requests.
|
|
82
|
+
*
|
|
83
|
+
* The number of requests to be executed simultaneously.
|
|
84
|
+
*
|
|
85
|
+
* If you configure a value greater than one, the dynamic executor will
|
|
86
|
+
* process the functions concurrently with the given capacity value.
|
|
87
|
+
*
|
|
88
|
+
* @default 1
|
|
89
|
+
*/
|
|
90
|
+
simultaneous?: number;
|
|
80
91
|
/**
|
|
81
92
|
* Extension of dynamic functions.
|
|
82
93
|
*
|
|
@@ -114,7 +125,11 @@ export declare namespace DynamicExecutor {
|
|
|
114
125
|
*/
|
|
115
126
|
location: string;
|
|
116
127
|
/**
|
|
117
|
-
*
|
|
128
|
+
* Returned value from the function.
|
|
129
|
+
*/
|
|
130
|
+
value: unknown;
|
|
131
|
+
/**
|
|
132
|
+
* Error when occurred.
|
|
118
133
|
*/
|
|
119
134
|
error: Error | null;
|
|
120
135
|
/**
|
package/lib/DynamicExecutor.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,8 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g =
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
47
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
48
|
function step(op) {
|
|
39
49
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -146,10 +156,11 @@ var DynamicExecutor;
|
|
|
146
156
|
DynamicExecutor.validate = function (props) { return main(false)(props); };
|
|
147
157
|
var main = function (assert) {
|
|
148
158
|
return function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
149
|
-
var report, executor,
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
159
|
+
var report, executor, processes;
|
|
160
|
+
var _this = this;
|
|
161
|
+
var _a, _b;
|
|
162
|
+
return __generator(this, function (_c) {
|
|
163
|
+
switch (_c.label) {
|
|
153
164
|
case 0:
|
|
154
165
|
report = {
|
|
155
166
|
location: props.location,
|
|
@@ -157,89 +168,128 @@ var DynamicExecutor;
|
|
|
157
168
|
executions: [],
|
|
158
169
|
};
|
|
159
170
|
executor = execute(props)(report)(assert);
|
|
160
|
-
|
|
161
|
-
|
|
171
|
+
return [4 /*yield*/, iterate({
|
|
172
|
+
extension: (_a = props.extension) !== null && _a !== void 0 ? _a : "js",
|
|
173
|
+
location: props.location,
|
|
174
|
+
executor: executor,
|
|
175
|
+
})];
|
|
162
176
|
case 1:
|
|
163
|
-
|
|
177
|
+
processes = _c.sent();
|
|
178
|
+
return [4 /*yield*/, Promise.all(new Array((_b = props.simultaneous) !== null && _b !== void 0 ? _b : 1).fill(0).map(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
179
|
+
var task;
|
|
180
|
+
return __generator(this, function (_a) {
|
|
181
|
+
switch (_a.label) {
|
|
182
|
+
case 0:
|
|
183
|
+
if (!(processes.length !== 0)) return [3 /*break*/, 2];
|
|
184
|
+
task = processes.shift();
|
|
185
|
+
return [4 /*yield*/, (task === null || task === void 0 ? void 0 : task())];
|
|
186
|
+
case 1:
|
|
187
|
+
_a.sent();
|
|
188
|
+
return [3 /*break*/, 0];
|
|
189
|
+
case 2: return [2 /*return*/];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}); }))];
|
|
193
|
+
case 2:
|
|
194
|
+
_c.sent();
|
|
164
195
|
report.time = Date.now() - report.time;
|
|
165
196
|
return [2 /*return*/, report];
|
|
166
197
|
}
|
|
167
198
|
});
|
|
168
199
|
}); };
|
|
169
200
|
};
|
|
170
|
-
var iterate = function (
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
201
|
+
var iterate = function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
202
|
+
var container, visitor;
|
|
203
|
+
var _this = this;
|
|
204
|
+
return __generator(this, function (_a) {
|
|
205
|
+
switch (_a.label) {
|
|
206
|
+
case 0:
|
|
207
|
+
container = [];
|
|
208
|
+
visitor = function (path) { return __awaiter(_this, void 0, void 0, function () {
|
|
209
|
+
var directory, _loop_1, directory_1, directory_1_1, file, e_1_1;
|
|
210
|
+
var e_1, _a;
|
|
211
|
+
return __generator(this, function (_b) {
|
|
212
|
+
switch (_b.label) {
|
|
213
|
+
case 0: return [4 /*yield*/, fs_1.default.promises.readdir(path)];
|
|
214
|
+
case 1:
|
|
215
|
+
directory = _b.sent();
|
|
216
|
+
_loop_1 = function (file) {
|
|
217
|
+
var location_1, stats, modulo;
|
|
218
|
+
return __generator(this, function (_c) {
|
|
219
|
+
switch (_c.label) {
|
|
220
|
+
case 0:
|
|
221
|
+
location_1 = path_1.default.resolve("".concat(path, "/").concat(file));
|
|
222
|
+
return [4 /*yield*/, fs_1.default.promises.lstat(location_1)];
|
|
223
|
+
case 1:
|
|
224
|
+
stats = _c.sent();
|
|
225
|
+
if (!(stats.isDirectory() === true)) return [3 /*break*/, 3];
|
|
226
|
+
return [4 /*yield*/, visitor(location_1)];
|
|
227
|
+
case 2:
|
|
228
|
+
_c.sent();
|
|
229
|
+
return [2 /*return*/, "continue"];
|
|
230
|
+
case 3:
|
|
231
|
+
if (file.substr(-3) !== ".".concat(props.extension))
|
|
232
|
+
return [2 /*return*/, "continue"];
|
|
233
|
+
_c.label = 4;
|
|
234
|
+
case 4: return [4 /*yield*/, Promise.resolve("".concat(location_1)).then(function (s) { return __importStar(require(s)); })];
|
|
235
|
+
case 5:
|
|
236
|
+
modulo = _c.sent();
|
|
237
|
+
container.push(function () { return props.executor(location_1, modulo); });
|
|
238
|
+
return [2 /*return*/];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
_b.label = 2;
|
|
243
|
+
case 2:
|
|
244
|
+
_b.trys.push([2, 7, 8, 9]);
|
|
245
|
+
directory_1 = __values(directory), directory_1_1 = directory_1.next();
|
|
246
|
+
_b.label = 3;
|
|
247
|
+
case 3:
|
|
248
|
+
if (!!directory_1_1.done) return [3 /*break*/, 6];
|
|
249
|
+
file = directory_1_1.value;
|
|
250
|
+
return [5 /*yield**/, _loop_1(file)];
|
|
251
|
+
case 4:
|
|
252
|
+
_b.sent();
|
|
253
|
+
_b.label = 5;
|
|
254
|
+
case 5:
|
|
255
|
+
directory_1_1 = directory_1.next();
|
|
256
|
+
return [3 /*break*/, 3];
|
|
257
|
+
case 6: return [3 /*break*/, 9];
|
|
258
|
+
case 7:
|
|
259
|
+
e_1_1 = _b.sent();
|
|
260
|
+
e_1 = { error: e_1_1 };
|
|
261
|
+
return [3 /*break*/, 9];
|
|
262
|
+
case 8:
|
|
263
|
+
try {
|
|
264
|
+
if (directory_1_1 && !directory_1_1.done && (_a = directory_1.return)) _a.call(directory_1);
|
|
265
|
+
}
|
|
266
|
+
finally { if (e_1) throw e_1.error; }
|
|
267
|
+
return [7 /*endfinally*/];
|
|
268
|
+
case 9: return [2 /*return*/];
|
|
219
269
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
};
|
|
228
|
-
};
|
|
270
|
+
});
|
|
271
|
+
}); };
|
|
272
|
+
return [4 /*yield*/, visitor(props.location)];
|
|
273
|
+
case 1:
|
|
274
|
+
_a.sent();
|
|
275
|
+
return [2 /*return*/, container];
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}); };
|
|
229
279
|
var execute = function (props) {
|
|
230
280
|
return function (report) {
|
|
231
281
|
return function (assert) {
|
|
232
282
|
return function (location, modulo) { return __awaiter(_this, void 0, void 0, function () {
|
|
233
|
-
var
|
|
283
|
+
var _loop_2, _a, _b, _c, key, closure, e_2_1;
|
|
234
284
|
var e_2, _d;
|
|
235
285
|
var _this = this;
|
|
236
286
|
return __generator(this, function (_e) {
|
|
237
287
|
switch (_e.label) {
|
|
238
288
|
case 0:
|
|
239
|
-
|
|
240
|
-
var func, result, exp_1;
|
|
241
|
-
return __generator(this, function (
|
|
242
|
-
switch (
|
|
289
|
+
_loop_2 = function (key, closure) {
|
|
290
|
+
var func, result, _f, exp_1;
|
|
291
|
+
return __generator(this, function (_g) {
|
|
292
|
+
switch (_g.label) {
|
|
243
293
|
case 0:
|
|
244
294
|
if (key.substring(0, props.prefix.length) !== props.prefix ||
|
|
245
295
|
typeof closure !== "function" ||
|
|
@@ -265,21 +315,23 @@ var DynamicExecutor;
|
|
|
265
315
|
result = {
|
|
266
316
|
name: key,
|
|
267
317
|
location: location,
|
|
318
|
+
value: undefined,
|
|
268
319
|
error: null,
|
|
269
320
|
started_at: new Date().toISOString(),
|
|
270
321
|
completed_at: new Date().toISOString(),
|
|
271
322
|
};
|
|
272
323
|
report.executions.push(result);
|
|
273
|
-
|
|
324
|
+
_g.label = 1;
|
|
274
325
|
case 1:
|
|
275
|
-
|
|
326
|
+
_g.trys.push([1, 3, 4, 5]);
|
|
327
|
+
_f = result;
|
|
276
328
|
return [4 /*yield*/, func()];
|
|
277
329
|
case 2:
|
|
278
|
-
_f.sent();
|
|
330
|
+
_f.value = _g.sent();
|
|
279
331
|
result.completed_at = new Date().toISOString();
|
|
280
332
|
return [3 /*break*/, 5];
|
|
281
333
|
case 3:
|
|
282
|
-
exp_1 =
|
|
334
|
+
exp_1 = _g.sent();
|
|
283
335
|
result.error = exp_1;
|
|
284
336
|
if (assert === true)
|
|
285
337
|
throw exp_1;
|
|
@@ -301,7 +353,7 @@ var DynamicExecutor;
|
|
|
301
353
|
case 2:
|
|
302
354
|
if (!!_b.done) return [3 /*break*/, 5];
|
|
303
355
|
_c = __read(_b.value, 2), key = _c[0], closure = _c[1];
|
|
304
|
-
return [5 /*yield**/,
|
|
356
|
+
return [5 /*yield**/, _loop_2(key, closure)];
|
|
305
357
|
case 3:
|
|
306
358
|
_e.sent();
|
|
307
359
|
_e.label = 4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicExecutor.js","sourceRoot":"","sources":["../src/DynamicExecutor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DynamicExecutor.js","sourceRoot":"","sources":["../src/DynamicExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;;;;gDAE/C,MAAM,CAAC,KAAK,GAAG,KAAY,CAAC;gDAC5B,IAAI,MAAM,KAAK,IAAI;oDAAE,MAAM,KAAG,CAAC;;;gDAE/B,MAAM,CAAC,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;gDAC/C,IAAI,KAAK,CAAC,UAAU;oDAAE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;;;;;;;;;gCAhCtB,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;;;;gCAAxC,KAAA,mBAAc,EAAb,GAAG,QAAA,EAAE,OAAO,QAAA;8DAAZ,GAAG,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;qBAmCzB;YApCD,CAoCC;QArCD,CAqCC;IAtCD,CAsCC,CAAC;AAKN,CAAC,EAlRgB,eAAe,+BAAf,eAAe,QAkR/B"}
|
package/lib/RandomGenerator.d.ts
CHANGED
|
@@ -37,10 +37,10 @@ export declare namespace RandomGenerator {
|
|
|
37
37
|
/**
|
|
38
38
|
* Generate random content.
|
|
39
39
|
*
|
|
40
|
-
* @param
|
|
40
|
+
* @param paragraphs Number of paragraphs
|
|
41
41
|
* @returns Currying function
|
|
42
42
|
*/
|
|
43
|
-
const content: (
|
|
43
|
+
const content: (paragraphs?: number) => (sentenceMin?: number, sentenceMax?: number) => (wordMin?: number, wordMax?: number) => string;
|
|
44
44
|
/**
|
|
45
45
|
* Generate random substring.
|
|
46
46
|
*
|
package/lib/RandomGenerator.js
CHANGED
|
@@ -74,11 +74,11 @@ var RandomGenerator;
|
|
|
74
74
|
/**
|
|
75
75
|
* Generate random content.
|
|
76
76
|
*
|
|
77
|
-
* @param
|
|
77
|
+
* @param paragraphs Number of paragraphs
|
|
78
78
|
* @returns Currying function
|
|
79
79
|
*/
|
|
80
|
-
RandomGenerator.content = function (
|
|
81
|
-
if (
|
|
80
|
+
RandomGenerator.content = function (paragraphs) {
|
|
81
|
+
if (paragraphs === void 0) { paragraphs = randint(3, 8); }
|
|
82
82
|
/**
|
|
83
83
|
* @param sentenceMin Minimum number of sentences in a paragraph
|
|
84
84
|
* @param sentenceMax Maximum number of sentences in a paragraph
|
|
@@ -95,7 +95,7 @@ var RandomGenerator;
|
|
|
95
95
|
return function (wordMin, wordMax) {
|
|
96
96
|
if (wordMin === void 0) { wordMin = 1; }
|
|
97
97
|
if (wordMax === void 0) { wordMax = 7; }
|
|
98
|
-
return new Array(
|
|
98
|
+
return new Array(paragraphs)
|
|
99
99
|
.fill("")
|
|
100
100
|
.map(function () {
|
|
101
101
|
return RandomGenerator.paragraph(randint(sentenceMin, sentenceMax))(wordMin, wordMax);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RandomGenerator.js","sourceRoot":"","sources":["../src/RandomGenerator.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAiB,eAAe,CAyJ/B;AAzJD,WAAiB,eAAe;IAC9B;;yEAEqE;IACrE,IAAM,UAAU,GAAG,4BAA4B,CAAC;IAChD,IAAM,OAAO,GAAW,YAAY,GAAG,UAAU,CAAC;IAElD;;;;;OAKG;IACU,yBAAS,GAAG,UAAC,MAAc;QACtC,OAAA,IAAI,KAAK,CAAC,MAAM,CAAC;aACd,IAAI,CAAC,EAAE,CAAC;aACR,GAAG,CAAC,cAAM,OAAA,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAA7C,CAA6C,CAAC;aACxD,IAAI,CAAC,EAAE,CAAC;IAHX,CAGW,CAAC;IAEd;;;;;;;OAOG;IACU,4BAAY,GAAG,UAAC,MAAc;QACzC,OAAA,IAAI,KAAK,CAAC,MAAM,CAAC;aACd,IAAI,CAAC,EAAE,CAAC;aACR,GAAG,CAAC,cAAM,OAAA,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG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declare namespace TestValidator {
|
|
|
74
74
|
*
|
|
75
75
|
* Test a pagination API supporting sorting options.
|
|
76
76
|
*
|
|
77
|
-
* You can validate detailed sorting options both
|
|
77
|
+
* You can validate detailed sorting options both ascending and descending orders
|
|
78
78
|
* with multiple fields. However, as it forms a complicate currying function,
|
|
79
|
-
* I
|
|
79
|
+
* I recommend you to see below example code before using.
|
|
80
80
|
*
|
|
81
81
|
* @param title Title of error message when sorting is invalid
|
|
82
82
|
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_sort.ts
|
package/lib/TestValidator.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -358,9 +358,9 @@ var TestValidator;
|
|
|
358
358
|
*
|
|
359
359
|
* Test a pagination API supporting sorting options.
|
|
360
360
|
*
|
|
361
|
-
* You can validate detailed sorting options both
|
|
361
|
+
* You can validate detailed sorting options both ascending and descending orders
|
|
362
362
|
* with multiple fields. However, as it forms a complicate currying function,
|
|
363
|
-
* I
|
|
363
|
+
* I recommend you to see below example code before using.
|
|
364
364
|
*
|
|
365
365
|
* @param title Title of error message when sorting is invalid
|
|
366
366
|
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_sort.ts
|
package/lib/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAgC;AAEhC,kBAAe,GAAG,CAAC;AACnB,2CAAyB"}
|
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nestia/e2e",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "E2E test utilify functions",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"typings": "lib/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "npm run build:main && npm run build:test",
|
|
9
|
-
"build:main": "rimraf lib && tsc",
|
|
10
|
-
"build:test": "rimraf bin && tsc -p test/tsconfig.json",
|
|
11
|
-
"dev": "npm run build:test -- --watch",
|
|
12
|
-
"eslint": "eslint src && eslint test",
|
|
13
|
-
"prepare": "ts-patch install && typia patch",
|
|
14
|
-
"test": "node bin/test"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/samchon/nestia"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"e2e",
|
|
22
|
-
"nestia",
|
|
23
|
-
"nestjs",
|
|
24
|
-
"test",
|
|
25
|
-
"tdd",
|
|
26
|
-
"utility"
|
|
27
|
-
],
|
|
28
|
-
"author": "Jeongho Nam",
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"bugs": {
|
|
31
|
-
"url": "https://github.com/samchon/nestia/issues"
|
|
32
|
-
},
|
|
33
|
-
"homepage": "https://nestia.io",
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
|
|
36
|
-
"@types/node": "^18.11.18",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
38
|
-
"@typescript-eslint/parser": "^5.57.0",
|
|
39
|
-
"rimraf": "^
|
|
40
|
-
"ts-node": "^10.9.1",
|
|
41
|
-
"ts-patch": "^3.
|
|
42
|
-
"typescript": "
|
|
43
|
-
"typescript-transform-paths": "^3.4.7",
|
|
44
|
-
"typia": "^6.
|
|
45
|
-
},
|
|
46
|
-
"files": [
|
|
47
|
-
"lib",
|
|
48
|
-
"src",
|
|
49
|
-
"README.md",
|
|
50
|
-
"LICENSE",
|
|
51
|
-
"package.json"
|
|
52
|
-
]
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@nestia/e2e",
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "E2E test utilify functions",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "npm run build:main && npm run build:test",
|
|
9
|
+
"build:main": "rimraf lib && tsc",
|
|
10
|
+
"build:test": "rimraf bin && tsc -p test/tsconfig.json",
|
|
11
|
+
"dev": "npm run build:test -- --watch",
|
|
12
|
+
"eslint": "eslint src && eslint test",
|
|
13
|
+
"prepare": "ts-patch install && typia patch",
|
|
14
|
+
"test": "node bin/test"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/samchon/nestia"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"e2e",
|
|
22
|
+
"nestia",
|
|
23
|
+
"nestjs",
|
|
24
|
+
"test",
|
|
25
|
+
"tdd",
|
|
26
|
+
"utility"
|
|
27
|
+
],
|
|
28
|
+
"author": "Jeongho Nam",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/samchon/nestia/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://nestia.io",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
|
|
36
|
+
"@types/node": "^18.11.18",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
38
|
+
"@typescript-eslint/parser": "^5.57.0",
|
|
39
|
+
"rimraf": "^6.0.1",
|
|
40
|
+
"ts-node": "^10.9.1",
|
|
41
|
+
"ts-patch": "^3.3.0",
|
|
42
|
+
"typescript": "~5.7.2",
|
|
43
|
+
"typescript-transform-paths": "^3.4.7",
|
|
44
|
+
"typia": "^7.6.0"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"lib",
|
|
48
|
+
"src",
|
|
49
|
+
"README.md",
|
|
50
|
+
"LICENSE",
|
|
51
|
+
"package.json"
|
|
52
|
+
]
|
|
53
|
+
}
|
package/src/DynamicExecutor.ts
CHANGED
|
@@ -88,9 +88,21 @@ export namespace DynamicExecutor {
|
|
|
88
88
|
wrapper?: (
|
|
89
89
|
name: string,
|
|
90
90
|
closure: Closure<Parameters, Ret>,
|
|
91
|
-
|
|
91
|
+
parameters: Parameters,
|
|
92
92
|
) => Promise<any>;
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Number of simultaneous requests.
|
|
96
|
+
*
|
|
97
|
+
* The number of requests to be executed simultaneously.
|
|
98
|
+
*
|
|
99
|
+
* If you configure a value greater than one, the dynamic executor will
|
|
100
|
+
* process the functions concurrently with the given capacity value.
|
|
101
|
+
*
|
|
102
|
+
* @default 1
|
|
103
|
+
*/
|
|
104
|
+
simultaneous?: number;
|
|
105
|
+
|
|
94
106
|
/**
|
|
95
107
|
* Extension of dynamic functions.
|
|
96
108
|
*
|
|
@@ -134,7 +146,12 @@ export namespace DynamicExecutor {
|
|
|
134
146
|
location: string;
|
|
135
147
|
|
|
136
148
|
/**
|
|
137
|
-
*
|
|
149
|
+
* Returned value from the function.
|
|
150
|
+
*/
|
|
151
|
+
value: unknown;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Error when occurred.
|
|
138
155
|
*/
|
|
139
156
|
error: Error | null;
|
|
140
157
|
|
|
@@ -189,35 +206,47 @@ export namespace DynamicExecutor {
|
|
|
189
206
|
};
|
|
190
207
|
|
|
191
208
|
const executor = execute(props)(report)(assert);
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
209
|
+
const processes: Array<() => Promise<void>> = await iterate({
|
|
210
|
+
extension: props.extension ?? "js",
|
|
211
|
+
location: props.location,
|
|
212
|
+
executor,
|
|
213
|
+
});
|
|
214
|
+
await Promise.all(
|
|
215
|
+
new Array(props.simultaneous ?? 1).fill(0).map(async () => {
|
|
216
|
+
while (processes.length !== 0) {
|
|
217
|
+
const task = processes.shift();
|
|
218
|
+
await task?.();
|
|
219
|
+
}
|
|
220
|
+
}),
|
|
221
|
+
);
|
|
195
222
|
report.time = Date.now() - report.time;
|
|
196
223
|
return report;
|
|
197
224
|
};
|
|
198
225
|
|
|
199
|
-
const iterate =
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
226
|
+
const iterate = async <Arguments extends any[]>(props: {
|
|
227
|
+
location: string;
|
|
228
|
+
extension: string;
|
|
229
|
+
executor: (path: string, modulo: Module<Arguments>) => Promise<void>;
|
|
230
|
+
}): Promise<Array<() => Promise<void>>> => {
|
|
231
|
+
const container: Array<() => Promise<void>> = [];
|
|
232
|
+
const visitor = async (path: string): Promise<void> => {
|
|
233
|
+
const directory: string[] = await fs.promises.readdir(path);
|
|
234
|
+
for (const file of directory) {
|
|
235
|
+
const location: string = NodePath.resolve(`${path}/${file}`);
|
|
236
|
+
const stats: fs.Stats = await fs.promises.lstat(location);
|
|
209
237
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
238
|
+
if (stats.isDirectory() === true) {
|
|
239
|
+
await visitor(location);
|
|
240
|
+
continue;
|
|
241
|
+
} else if (file.substr(-3) !== `.${props.extension}`) continue;
|
|
214
242
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
};
|
|
219
|
-
return visitor;
|
|
243
|
+
const modulo: Module<Arguments> = await import(location);
|
|
244
|
+
container.push(() => props.executor(location, modulo));
|
|
245
|
+
}
|
|
220
246
|
};
|
|
247
|
+
await visitor(props.location);
|
|
248
|
+
return container;
|
|
249
|
+
};
|
|
221
250
|
|
|
222
251
|
const execute =
|
|
223
252
|
<Arguments extends any[]>(props: IProps<Arguments>) =>
|
|
@@ -241,6 +270,7 @@ export namespace DynamicExecutor {
|
|
|
241
270
|
const result: IExecution = {
|
|
242
271
|
name: key,
|
|
243
272
|
location,
|
|
273
|
+
value: undefined,
|
|
244
274
|
error: null,
|
|
245
275
|
started_at: new Date().toISOString(),
|
|
246
276
|
completed_at: new Date().toISOString(),
|
|
@@ -248,7 +278,7 @@ export namespace DynamicExecutor {
|
|
|
248
278
|
report.executions.push(result);
|
|
249
279
|
|
|
250
280
|
try {
|
|
251
|
-
await func();
|
|
281
|
+
result.value = await func();
|
|
252
282
|
result.completed_at = new Date().toISOString();
|
|
253
283
|
} catch (exp) {
|
|
254
284
|
result.error = exp as Error;
|
package/src/RandomGenerator.ts
CHANGED
|
@@ -67,11 +67,11 @@ export namespace RandomGenerator {
|
|
|
67
67
|
/**
|
|
68
68
|
* Generate random content.
|
|
69
69
|
*
|
|
70
|
-
* @param
|
|
70
|
+
* @param paragraphs Number of paragraphs
|
|
71
71
|
* @returns Currying function
|
|
72
72
|
*/
|
|
73
73
|
export const content =
|
|
74
|
-
(
|
|
74
|
+
(paragraphs: number = randint(3, 8)) =>
|
|
75
75
|
/**
|
|
76
76
|
* @param sentenceMin Minimum number of sentences in a paragraph
|
|
77
77
|
* @param sentenceMax Maximum number of sentences in a paragraph
|
|
@@ -84,7 +84,7 @@ export namespace RandomGenerator {
|
|
|
84
84
|
* @returns Content generator
|
|
85
85
|
*/
|
|
86
86
|
(wordMin: number = 1, wordMax: number = 7): string =>
|
|
87
|
-
new Array(
|
|
87
|
+
new Array(paragraphs)
|
|
88
88
|
.fill("")
|
|
89
89
|
.map(() =>
|
|
90
90
|
paragraph(randint(sentenceMin, sentenceMax))(wordMin, wordMax),
|
package/src/TestValidator.ts
CHANGED
|
@@ -261,9 +261,9 @@ export namespace TestValidator {
|
|
|
261
261
|
*
|
|
262
262
|
* Test a pagination API supporting sorting options.
|
|
263
263
|
*
|
|
264
|
-
* You can validate detailed sorting options both
|
|
264
|
+
* You can validate detailed sorting options both ascending and descending orders
|
|
265
265
|
* with multiple fields. However, as it forms a complicate currying function,
|
|
266
|
-
* I
|
|
266
|
+
* I recommend you to see below example code before using.
|
|
267
267
|
*
|
|
268
268
|
* @param title Title of error message when sorting is invalid
|
|
269
269
|
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_sort.ts
|