@nestia/e2e
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,3 +1,7 @@ | ||
/** | ||
* Utility functions for arrays. | ||
* | ||
* @author Jeongho Nam - https://github.com/samchon | ||
*/ | ||
export declare namespace ArrayUtil { | ||
function at<T>(array: T[], index: number): T; | ||
function asyncFilter<Input>(elements: readonly Input[], pred: (elem: Input, index: number, array: readonly Input[]) => Promise<boolean>): Promise<Input[]>; | ||
@@ -4,0 +8,0 @@ function asyncForEach<Input>(elements: readonly Input[], closure: (elem: Input, index: number, array: readonly Input[]) => Promise<any>): Promise<void>; |
@@ -76,8 +76,9 @@ "use strict"; | ||
exports.ArrayUtil = void 0; | ||
/** | ||
* Utility functions for arrays. | ||
* | ||
* @author Jeongho Nam - https://github.com/samchon | ||
*/ | ||
var ArrayUtil; | ||
(function (ArrayUtil) { | ||
function at(array, index) { | ||
return array[index < 0 ? array.length + index : index]; | ||
} | ||
ArrayUtil.at = at; | ||
function asyncFilter(elements, pred) { | ||
@@ -84,0 +85,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -10,4 +10,4 @@ /** | ||
* | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/index.ts | ||
* @example https://github.com/samchon/backend/blob/master/src/test/index.ts | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/index.ts | ||
* @author Jeongho Nam - https://github.com/samchon | ||
@@ -14,0 +14,0 @@ */ |
@@ -116,4 +116,4 @@ "use strict"; | ||
* | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/index.ts | ||
* @example https://github.com/samchon/backend/blob/master/src/test/index.ts | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/index.ts | ||
* @author Jeongho Nam - https://github.com/samchon | ||
@@ -120,0 +120,0 @@ */ |
@@ -62,3 +62,3 @@ "use strict"; | ||
function compare(x, y) { | ||
return x[0].localeCompare(y[0]); | ||
return x.localeCompare(y); | ||
} | ||
@@ -65,0 +65,0 @@ function wrap(elem) { |
@@ -36,3 +36,3 @@ /** | ||
*/ | ||
const paragraph: (sentences: number) => (wordMin?: number, wordMax?: number) => string; | ||
const paragraph: (sentences?: number) => (wordMin?: number, wordMax?: number) => string; | ||
/** | ||
@@ -44,3 +44,3 @@ * Generate random content. | ||
*/ | ||
const content: (paragraphes: number) => (sentenceMin?: number, sentenceMax?: number) => (wordMin?: number, wordMax?: number) => string; | ||
const content: (paragraphes?: number) => (sentenceMin?: number, sentenceMax?: number) => (wordMin?: number, wordMax?: number) => string; | ||
/** | ||
@@ -47,0 +47,0 @@ * Generate random substring. |
@@ -64,2 +64,3 @@ "use strict"; | ||
RandomGenerator.paragraph = function (sentences) { | ||
if (sentences === void 0) { sentences = (0, tstl_1.randint)(2, 5); } | ||
/** | ||
@@ -86,2 +87,3 @@ * @param wordMin Minimum number of characters in a sentence | ||
RandomGenerator.content = function (paragraphes) { | ||
if (paragraphes === void 0) { paragraphes = (0, tstl_1.randint)(3, 8); } | ||
/** | ||
@@ -88,0 +90,0 @@ * @param sentenceMin Minimum number of sentences in a paragraph |
@@ -27,2 +27,5 @@ /** | ||
* @param title Title of error message when different | ||
* @return Currying function | ||
* | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_search.ts | ||
*/ | ||
@@ -29,0 +32,0 @@ const index: (title: string) => <Solution extends IEntity<any>>(expected: Solution[]) => <Summary extends IEntity<any>>(gotten: Summary[], trace?: boolean) => void; |
@@ -87,2 +87,5 @@ "use strict"; | ||
* @param title Title of error message when different | ||
* @return Currying function | ||
* | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_search.ts | ||
*/ | ||
@@ -89,0 +92,0 @@ TestValidator.index = function (title) { |
{ | ||
"name": "@nestia/e2e", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "E2E test utilify functions", | ||
@@ -9,2 +9,3 @@ "main": "lib/index.js", | ||
"dev": "npm run build -- --watch", | ||
"prettier": "prettier --write ./src/**/*.ts", | ||
"test": "node lib/test" | ||
@@ -31,4 +32,6 @@ }, | ||
"devDependencies": { | ||
"@trivago/prettier-plugin-sort-imports": "^4.0.0", | ||
"@types/cli": "^0.11.21", | ||
"@types/node": "^18.11.18", | ||
"prettier": "^2.8.3", | ||
"rimraf": "^4.1.2", | ||
@@ -35,0 +38,0 @@ "typescript": "^4.9.5" |
@@ -13,12 +13,13 @@ # Nestia E2E Helper | ||
```typescript | ||
import { | ||
ArrayUtil, | ||
GaffComparator, | ||
RandomGenerator, | ||
TestValidator, | ||
} from "@nestia/e2e"; | ||
import typia from "typia"; | ||
import { | ||
ArrayUtil, | ||
GaffComparator, | ||
RandomGenerator, | ||
TestValidator | ||
} from "@nestia/e2e"; | ||
import api from "@samchon/bbs-api/lib/index"; | ||
import { IBbsArticle } from "@samchon/bbs-api/lib/structures/bbs/IBbsArticle"; | ||
import { IPage } from "@samchon/bbs-api/lib/structures/common/IPage"; | ||
@@ -33,4 +34,4 @@ export async function test_api_bbs_article_index_sort( | ||
writer: RandomGenerator.name(), | ||
title: RandomGenerator.paragraph(), | ||
body: RandomGenerator.content(), | ||
title: RandomGenerator.paragraph(5)(), | ||
body: RandomGenerator.content(8)()(), | ||
format: "txt", | ||
@@ -44,5 +45,13 @@ files: [], | ||
// PREPARE VALIDATOR | ||
const validator = validate_index_sort("BbsArticleProvider.idex()")( | ||
(input: IBbsArticle.IRequest) => | ||
api.functional.bbs.articles.index(connection, section, input), | ||
const validator = TestValidator.sort("BbsArticleProvider.index()")( | ||
async ( | ||
sort: IPage.IRequest.Sort<IBbsArticle.IRequest.SortableColumns>, | ||
) => { | ||
const page: IPage<IBbsArticle.ISummary> = | ||
await api.functional.bbs.articles.index(connection, section, { | ||
limit: 100, | ||
sort, | ||
}); | ||
return typia.assertEquals(page).data; | ||
}, | ||
); | ||
@@ -62,4 +71,4 @@ | ||
for (const comp of components) { | ||
await comp("+"); | ||
await comp("-"); | ||
await comp("+", false); | ||
await comp("-", false); | ||
} | ||
@@ -66,0 +75,0 @@ } |
@@ -0,6 +1,7 @@ | ||
/** | ||
* Utility functions for arrays. | ||
* | ||
* @author Jeongho Nam - https://github.com/samchon | ||
*/ | ||
export namespace ArrayUtil { | ||
export function at<T>(array: T[], index: number): T { | ||
return array[index < 0 ? array.length + index : index]; | ||
} | ||
export async function asyncFilter<Input>( | ||
@@ -7,0 +8,0 @@ elements: readonly Input[], |
@@ -17,4 +17,4 @@ import chalk from "chalk"; | ||
* | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/index.ts | ||
* @example https://github.com/samchon/backend/blob/master/src/test/index.ts | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/index.ts | ||
* @author Jeongho Nam - https://github.com/samchon | ||
@@ -21,0 +21,0 @@ */ |
@@ -63,3 +63,3 @@ /** | ||
function compare(x: string, y: string) { | ||
return x[0].localeCompare(y[0]); | ||
return x.localeCompare(y); | ||
} | ||
@@ -66,0 +66,0 @@ |
@@ -0,0 +0,0 @@ import * as e2e from "./module"; |
@@ -0,0 +0,0 @@ export * from "./ArrayUtil"; |
@@ -61,3 +61,3 @@ import { back_inserter, randint } from "tstl"; | ||
export const paragraph = | ||
(sentences: number) => | ||
(sentences: number = randint(2, 5)) => | ||
/** | ||
@@ -81,3 +81,3 @@ * @param wordMin Minimum number of characters in a sentence | ||
export const content = | ||
(paragraphes: number) => | ||
(paragraphes: number = randint(3, 8)) => | ||
/** | ||
@@ -84,0 +84,0 @@ * @param sentenceMin Minimum number of sentences in a paragraph |
@@ -0,0 +0,0 @@ /** |
@@ -39,2 +39,5 @@ import { is_sorted } from "tstl/ranges"; | ||
* @param title Title of error message when different | ||
* @return Currying function | ||
* | ||
* @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_search.ts | ||
*/ | ||
@@ -41,0 +44,0 @@ export const index = |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112860
2225
96
6