@nestia/e2e 0.2.2-dev.20230505 → 0.2.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/README.md CHANGED
@@ -1,96 +1,60 @@
1
- # Nestia E2E Helper
1
+ # Nestia
2
+ ![Nestia Logo](https://nestia.io/logo.png)
3
+
2
4
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
3
- [![npm version](https://img.shields.io/npm/v/@nestia/e2e.svg)](https://www.npmjs.com/package/@nestia/e2e)
4
- [![Downloads](https://img.shields.io/npm/dm/@nestia/e2e.svg)](https://www.npmjs.com/package/@nestia/e2e)
5
- [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
6
- [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://typia.io/docs/)
7
-
8
- Helper library for E2E testing in NestJS.
9
-
10
- With `@nestia/e2e`, you can easily validate your NestJS server through E2E testing.
11
-
12
- ```typescript
13
- import {
14
- ArrayUtil,
15
- GaffComparator,
16
- RandomGenerator,
17
- TestValidator,
18
- } from "@nestia/e2e";
19
- import typia from "typia";
20
-
21
- import api from "@samchon/bbs-api/lib/index";
22
- import { IBbsArticle } from "@samchon/bbs-api/lib/structures/bbs/IBbsArticle";
23
- import { IPage } from "@samchon/bbs-api/lib/structures/common/IPage";
24
-
25
- export async function test_api_bbs_article_index_sort(
26
- connection: api.IConnection,
27
- ): Promise<void> {
28
- // GENERATE 100 ARTICLES
29
- const section: string = "general";
30
- const articles: IBbsArticle[] = await ArrayUtil.asyncRepeat(100, () =>
31
- api.functional.bbs.articles.store(connection, section, {
32
- writer: RandomGenerator.name(),
33
- title: RandomGenerator.paragraph(5)(),
34
- body: RandomGenerator.content(8)()(),
35
- format: "txt",
36
- files: [],
37
- password: RandomGenerator.alphabets(8),
38
- }),
39
- );
40
- typia.assertEquals(articles);
41
-
42
- // PREPARE VALIDATOR
43
- const validator = TestValidator.sort("BbsArticleProvider.index()")(
44
- async (
45
- sort: IPage.IRequest.Sort<IBbsArticle.IRequest.SortableColumns>,
46
- ) => {
47
- const page: IPage<IBbsArticle.ISummary> =
48
- await api.functional.bbs.articles.index(connection, section, {
49
- limit: 100,
50
- sort,
51
- });
52
- return typia.assertEquals(page).data;
53
- },
54
- );
55
-
56
- // DO VALIDATE
57
- const components = [
58
- validator("created_at")(GaffComparator.dates((x) => x.created_at)),
59
- validator("updated_at")(GaffComparator.dates((x) => x.updated_at)),
60
- validator("title")(GaffComparator.strings((x) => x.title)),
61
- validator("writer")(GaffComparator.strings((x) => x.writer)),
62
- validator(
63
- "writer",
64
- "title",
65
- )(GaffComparator.strings((x) => [x.writer, x.title])),
66
- ];
67
- for (const comp of components) {
68
- await comp("+", false);
69
- await comp("-", false);
70
- }
71
- }
72
- ```
73
-
74
-
75
-
76
-
77
- ## Setup
78
- ```bash
79
- npm install --save-dev @nestia/e2e
80
- ```
81
-
82
- Just setup with npm command, that's all.
83
-
84
- For referece, due to test program would not be published, I rcommend to install as `dev` mode.
85
-
86
-
87
-
88
-
89
- ## Features
90
- About supported features, read descriptive comments of below:
91
-
92
- - [`ArrayUtil`](https://github.com/samchon/nestia/tree/master/packages/e2e/src/ArrayUtil.ts)
93
- - [`GaffComparator`](https://github.com/samchon/nestia/tree/master/packages/e2e/src/GaffComparator.ts)
94
- - [`RandomGenerator`](https://github.com/samchon/nestia/tree/master/packages/e2e/src/RandomGenerator.ts)
95
- - [`StopWatch`](https://github.com/samchon/nestia/tree/master/packages/e2e/src/StopWatch.ts)
96
- - [`TestValidator`](https://github.com/samchon/nestia/tree/master/packages/e2e/src/TestValidator.ts)
5
+ [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
6
+ [![Downloads](https://img.shields.io/npm/dm/nestia.svg)](https://www.npmjs.com/package/nestia)
7
+ [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
8
+ [![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)
9
+
10
+ Nestia is a set of helper libraries for NestJS, supporting below features:
11
+
12
+ - `@nestia/core`: super-fast decorators
13
+ - `@nestia/sdk`:
14
+ - SDK generator for clients
15
+ - Swagger generator evolved than ever
16
+ - Automatic E2E test functions generator
17
+ - `nestia`: just CLI (command line interface) tool
18
+
19
+ > **Note**
20
+ >
21
+ > - **Only one line** required, with pure TypeScript type
22
+ > - Runtime validator is **20,000x faster** than `class-validator`
23
+ > - JSON serialization is **200x faster** than `class-transformer`
24
+ > - SDK is similar with [tRPC](https://trpc.io), but much advanced
25
+
26
+ ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
27
+
28
+ > Left is server code, and right is client code utilizing SDK
29
+
30
+
31
+
32
+
33
+ ## Sponsors and Backers
34
+ Thanks for your support.
35
+
36
+ Your donation would encourage `nestia` development.
37
+
38
+ [![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)
39
+
40
+
41
+
42
+
43
+ ## Guide Documents
44
+ Check out the document in the [website](https://nestia.io/docs/):
45
+
46
+ ### 🏠 Home
47
+ - [Introduction](https://nestia.io/docs/)
48
+ - [Setup](https://nestia.io/docs/setup/)
49
+
50
+ ### 📖 Features
51
+ - [Pure TypeScript](https://nestia.io/docs/pure)
52
+ - Core Library
53
+ - [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
54
+ - [TypedBody](https://nestia.io/docs/core/TypedBody/)
55
+ - [TypedParam](https://nestia.io/docs/core/TypedParam/)
56
+ - [TypedQuery](https://nestia.io/docs/core/TypedRoute/)
57
+ - Generators
58
+ - [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
59
+ - [SDK Library](https://nestia.io/docs/sdk/sdk/)
60
+ - [E2E Functions](https://nestia.io/docs/sdk/e2e/)
@@ -53,7 +53,7 @@ export declare namespace RandomGenerator {
53
53
  *
54
54
  * @param prefix Prefix string, default is "010"
55
55
  * @returns Random mobile number
56
- * @example 010-334-0067
56
+ * @example 0103340067
57
57
  */
58
58
  const mobile: (prefix?: string) => string;
59
59
  /**
@@ -122,7 +122,7 @@ var RandomGenerator;
122
122
  *
123
123
  * @param prefix Prefix string, default is "010"
124
124
  * @returns Random mobile number
125
- * @example 010-334-0067
125
+ * @example 0103340067
126
126
  */
127
127
  RandomGenerator.mobile = function (prefix) {
128
128
  if (prefix === void 0) { prefix = "010"; }
@@ -133,7 +133,7 @@ var RandomGenerator;
133
133
  return value.toString().padStart(value < 1000 ? 3 : 4, "0");
134
134
  })(),
135
135
  (0, tstl_1.randint)(0, 9999).toString().padStart(4, "0"),
136
- ].join("-");
136
+ ].join("");
137
137
  };
138
138
  /**
139
139
  * Generate random date.
@@ -1 +1 @@
1
- {"version":3,"file":"RandomGenerator.js","sourceRoot":"","sources":["../src/RandomGenerator.ts"],"names":[],"mappings":";;;AAAA,6BAA8C;AAC9C,sCAAgD;AAEhD;;;;GAIG;AACH,IAAiB,eAAe,CA4J/B;AA5JD,WAAiB,eAAe;IAC5B;;uEAEmE;IACnE,IAAM,UAAU,GAAG,4BAA4B,CAAC;IAChD,IAAM,OAAO,GAAW,YAAY,GAAG,UAAU,CAAC;IAElD;;;;;OAKG;IACU,yBAAS,GAAG,UAAC,MAAc;QACpC,OAAA,IAAI,KAAK,CAAC,MAAM,CAAC;aACZ,IAAI,CAAC,EAAE,CAAC;aACR,GAAG,CAAC,cAAM,OAAA,UAAU,CAAC,IAAA,cAAO,EAAC,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAA7C,CAA6C,CAAC;aACxD,IAAI,CAAC,EAAE,CAAC;IAHb,CAGa,CAAC;IAElB;;;;;;;OAOG;IACU,4BAAY,GAAG,UAAC,MAAc;QACvC,OAAA,IAAI,KAAK,CAAC,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AAa;YACV,OAAA,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAA,cAAO,EAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAA5C,CAA4C;IADhD,CACgD,CAAC;IAErD;;;;;;OAMG;IACU,sBAAM,GACf,UAAI,KAAU;QACd,OAAA,UAAC,KAAa;YACV,IAAM,GAAG,GAAQ,EAAE,CAAC;YACpB,IAAA,eAAO,EAAC,KAAK,EAAE,IAAA,oBAAa,EAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;YAC1C,OAAO,GAAG,CAAC;QACf,CAAC;IAJD,CAIC,CAAC;IAEN;;;;;OAKG;IACU,oBAAI,GAAG,UAAI,KAAU;QAC9B,OAAA,KAAK,CAAC,IAAA,cAAO,EAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAAnC,CAAmC,CAAC;AAC5C,CAAC,EA5JgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA4J/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/e2e",
3
- "version": "0.2.2-dev.20230505",
3
+ "version": "0.2.3",
4
4
  "description": "E2E test utilify functions",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -115,7 +115,7 @@ export namespace RandomGenerator {
115
115
  *
116
116
  * @param prefix Prefix string, default is "010"
117
117
  * @returns Random mobile number
118
- * @example 010-334-0067
118
+ * @example 0103340067
119
119
  */
120
120
  export const mobile = (prefix: string = "010"): string =>
121
121
  [
@@ -125,7 +125,7 @@ export namespace RandomGenerator {
125
125
  return value.toString().padStart(value < 1_000 ? 3 : 4, "0");
126
126
  })(),
127
127
  randint(0, 9999).toString().padStart(4, "0"),
128
- ].join("-");
128
+ ].join("");
129
129
 
130
130
  /**
131
131
  * Generate random date.