Socket
Socket
Sign inDemoInstall

@nestia/e2e

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestia/e2e - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

8

lib/TestValidator.d.ts

@@ -42,8 +42,8 @@ /**

*/
const search: (title: string) => <Entity extends IEntity<any>, Input>(getter: (input: Input) => Promise<Entity[]>, validator?: ((data: Entity[]) => any) | undefined) => (total: Entity[], sampleCount?: number) => <Values extends any[]>(props: ISearchProps<Entity, Values, Input>) => Promise<void>;
interface ISearchProps<Entity extends IEntity<any>, Values extends any[], Input> {
const search: (title: string) => <Entity extends IEntity<any>, Request_1>(getter: (input: Request_1) => Promise<Entity[]>) => (total: Entity[], sampleCount?: number) => <Values extends any[]>(props: ISearchProps<Entity, Values, Request_1>) => Promise<void>;
interface ISearchProps<Entity extends IEntity<any>, Values extends any[], Request> {
fields: string[];
values(entity: Entity): Values;
filter(entity: Entity, values: Values): boolean;
search(values: Values): Input;
request(values: Values): Request;
}

@@ -62,3 +62,3 @@ /**

*/
const sort: (title: string) => <T extends object, Fields extends string, Sortable_1 extends (`-${Fields}` | `+${Fields}`)[]>(getter: (sortable: Sortable_1) => Promise<T[]>, validator?: ((data: T[]) => any) | undefined) => (...fields: Fields[]) => (comp: (x: T, y: T) => number, filter?: ((elem: T) => boolean) | undefined) => (direction: "+" | "-", trace?: boolean) => Promise<void>;
const sort: (title: string) => <T extends object, Fields extends string, Sortable_1 extends (`-${Fields}` | `+${Fields}`)[]>(getter: (sortable: Sortable_1) => Promise<T[]>) => (...fields: Fields[]) => (comp: (x: T, y: T) => number, filter?: ((elem: T) => boolean) | undefined) => (direction: "+" | "-", trace?: boolean) => Promise<void>;
type Sortable<Literal extends string> = Array<`-${Literal}` | `+${Literal}`>;

@@ -65,0 +65,0 @@ }

@@ -139,5 +139,4 @@ "use strict";

* @param getter A pagination API function to be called
* @param validator Validator function if required
*/
return function (getter, validator) {
return function (getter) {
/**

@@ -168,7 +167,5 @@ * @param total Total entity records for comparison

});
return [4 /*yield*/, getter(props.search(values))];
return [4 /*yield*/, getter(props.request(values))];
case 1:
gotten = _c.sent();
if (validator)
validator(gotten);
TestValidator.index("".concat(title, " (").concat(props.fields.join(", "), ")"))(filtered)(gotten);

@@ -228,3 +225,3 @@ return [2 /*return*/];

*/
return function (getter, validator) {
return function (getter) {
/**

@@ -255,4 +252,2 @@ * @param fields List of fields to be sorted

data = _a.sent();
if (validator)
validator(data);
if (filter)

@@ -259,0 +254,0 @@ data = data.filter(filter);

{
"name": "@nestia/e2e",
"version": "0.1.3",
"version": "0.1.4",
"description": "E2E test utilify functions",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -87,7 +87,5 @@ import { is_sorted } from "tstl/ranges";

* @param getter A pagination API function to be called
* @param validator Validator function if required
*/
<Entity extends IEntity<any>, Input>(
getter: (input: Input) => Promise<Entity[]>,
validator?: (data: Entity[]) => any,
<Entity extends IEntity<any>, Request>(
getter: (input: Request) => Promise<Entity[]>,
) =>

@@ -103,4 +101,4 @@ /**

async <Values extends any[]>(
props: ISearchProps<Entity, Values, Input>,
) => {
props: ISearchProps<Entity, Values, Request>,
): Promise<void> => {
const samples: Entity[] = RandomGenerator.sample(

@@ -115,4 +113,3 @@ total,

);
const gotten: Entity[] = await getter(props.search(values));
if (validator) validator(gotten);
const gotten: Entity[] = await getter(props.request(values));

@@ -128,3 +125,3 @@ TestValidator.index(`${title} (${props.fields.join(", ")})`)(

Values extends any[],
Input,
Request,
> {

@@ -134,3 +131,3 @@ fields: string[];

filter(entity: Entity, values: Values): boolean;
search(values: Values): Input;
request(values: Values): Request;
}

@@ -161,3 +158,2 @@

getter: (sortable: Sortable) => Promise<T[]>,
validator?: (data: T[]) => any,
) =>

@@ -182,3 +178,2 @@ /**

);
if (validator) validator(data);
if (filter) data = data.filter(filter);

@@ -185,0 +180,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc