Skip to content

Commit e7d4b9e

Browse files
authored
Merge pull request #1371 from samchon/feat/e2e
Enhance `@nestia/e2e` types
2 parents f74dc65 + 34cd644 commit e7d4b9e

File tree

10 files changed

+42
-24
lines changed

10 files changed

+42
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@nestia/station",
4-
"version": "8.0.0",
4+
"version": "8.0.1",
55
"description": "Nestia station",
66
"scripts": {
77
"build": "node deploy build",

packages/benchmark/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/benchmark",
3-
"version": "7.1.1-dev.20250714",
3+
"version": "8.0.1-dev.20250831",
44
"description": "NestJS Performance Benchmark Program",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nestia",
3-
"version": "7.1.1-dev.20250714",
3+
"version": "8.0.1-dev.20250831",
44
"description": "Nestia CLI tool",
55
"main": "bin/index.js",
66
"bin": {

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/core",
3-
"version": "7.1.1-dev.20250714",
3+
"version": "8.0.1-dev.20250831",
44
"description": "Super-fast validation decorators of NestJS",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
@@ -52,7 +52,7 @@
5252
"ws": "^7.5.3"
5353
},
5454
"peerDependencies": {
55-
"@nestia/fetcher": ">=7.1.1-dev.20250714",
55+
"@nestia/fetcher": ">=8.0.1-dev.20250831",
5656
"@nestjs/common": ">=7.0.1",
5757
"@nestjs/core": ">=7.0.1",
5858
"@samchon/openapi": ">=4.5.0 <5.0.0",

packages/e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/e2e",
3-
"version": "7.1.1-dev.20250714",
3+
"version": "8.0.1-dev.20250831",
44
"description": "E2E test utilify functions",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

packages/e2e/src/RandomGenerator.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ export namespace RandomGenerator {
130130
* ```
131131
*
132132
* @param length - Number of words in the name (default: random between 2-3)
133-
* @returns A space-separated string of random words (each 3-7 chars by default)
133+
* @returns A space-separated string of random words (each 3-7 chars by
134+
* default)
134135
*/
135136
export const name = (length: number = randint(2, 3)): string =>
136137
paragraph({
@@ -322,7 +323,7 @@ export namespace RandomGenerator {
322323
* @example
323324
* ```typescript
324325
* RandomGenerator.mobile(); // e.g. "0103341234" or "01012345678"
325-
* RandomGenerator.mobile("011"); // e.g. "0119876543" or "01112345678"
326+
* RandomGenerator.mobile("011"); // e.g. "0119876543" or "01112345678"
326327
* RandomGenerator.mobile("+82"); // e.g. "+823341234" or "+8212345678"
327328
*
328329
* // Generate test user phone numbers
@@ -480,7 +481,8 @@ export namespace RandomGenerator {
480481
* @param array - The source array to pick an element from
481482
* @returns A randomly selected element from the array
482483
*/
483-
export const pick = <T>(array: T[]): T => array[randint(0, array.length - 1)];
484+
export const pick = <T>(array: readonly T[]): T =>
485+
array[randint(0, array.length - 1)];
484486
}
485487

486488
/** @internal */

packages/e2e/src/TestValidator.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,25 @@ export namespace TestValidator {
118118
* ```;
119119
*
120120
* @param title - Descriptive title used in error messages when values differ
121-
* @param x - The first value to compare
121+
* @param X - The first value to compare
122122
* @param y - The second value to compare (can be null or undefined)
123123
* @param exception - Optional filter function to exclude specific keys from
124124
* comparison
125125
* @throws Error with detailed diff information when values are not equal
126126
*/
127-
export function equals<T>(
127+
export function equals<X, Y extends X>(
128128
title: string,
129-
x: T,
130-
y: T | null | undefined,
129+
X: X,
130+
y: Y | null | undefined,
131131
exception?: (key: string) => boolean,
132132
): void {
133-
const diff: string[] = json_equal_to(exception ?? (() => false))(x)(y);
133+
const diff: string[] = json_equal_to(exception ?? (() => false))(X)(y);
134134
if (diff.length)
135135
throw new Error(
136136
[
137137
`Bug on ${title}: found different values - [${diff.join(", ")}]:`,
138138
"\n",
139-
JSON.stringify({ x, y }, null, 2),
139+
JSON.stringify({ x: X, y }, null, 2),
140140
].join("\n"),
141141
);
142142
}
@@ -175,10 +175,10 @@ export namespace TestValidator {
175175
* comparison
176176
* @throws Error when values are equal (indicating validation failure)
177177
*/
178-
export function notEquals<T>(
178+
export function notEquals<X, Y extends X>(
179179
title: string,
180-
x: T,
181-
y: T | null | undefined,
180+
x: X,
181+
y: Y | null | undefined,
182182
exception?: (key: string) => boolean,
183183
): void {
184184
const diff: string[] = json_equal_to(exception ?? (() => false))(x)(y);
@@ -349,10 +349,10 @@ export namespace TestValidator {
349349
* @param trace - Optional flag to enable debug logging (default: false)
350350
* @throws Error when entity order differs between expected and actual results
351351
*/
352-
export const index = <Summary extends IEntity<any>>(
352+
export const index = <X extends IEntity<any>, Y extends X>(
353353
title: string,
354-
expected: Summary[],
355-
gotten: Summary[],
354+
expected: X[],
355+
gotten: Y[],
356356
trace: boolean = false,
357357
): void => {
358358
const length: number = Math.min(expected.length, gotten.length);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestValidator } from "@nestia/e2e";
2+
3+
export const test_validate_xy = (): void => {
4+
interface IExplicit {
5+
id: string;
6+
name: string;
7+
}
8+
TestValidator.equals("xy", { id: "1" }, {
9+
id: "1",
10+
name: "John Doe",
11+
} satisfies IExplicit as IExplicit);
12+
TestValidator.notEquals("xy", { id: "1" }, {
13+
id: "2",
14+
name: "Kevin",
15+
} satisfies IExplicit as IExplicit);
16+
};

packages/fetcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/fetcher",
3-
"version": "7.1.1-dev.20250714",
3+
"version": "8.0.1-dev.20250831",
44
"description": "Fetcher library of Nestia SDK",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

packages/sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestia/sdk",
3-
"version": "7.1.1-dev.20250714",
3+
"version": "8.0.1-dev.20250831",
44
"description": "Nestia SDK and Swagger generator",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
@@ -47,7 +47,7 @@
4747
"typia": "^9.6.1"
4848
},
4949
"peerDependencies": {
50-
"@nestia/core": ">=7.1.1-dev.20250714"
50+
"@nestia/core": ">=8.0.1-dev.20250831"
5151
},
5252
"devDependencies": {
5353
"@nestjs/common": "^11.0.13",

0 commit comments

Comments
 (0)