UNPKG

@thisisagile/easy-test

Version:

Straightforward library for testing microservices built with @thisisagile/easy

40 lines (39 loc) 1.59 kB
import { Id, Json } from '../utils/Types'; import { Req } from '../utils/Req'; import { HttpStatus, Response } from '../utils/Response'; export declare class Mocks { req: { id: (id: Id) => Req; q: (q: unknown) => Req; with: (a: Json) => Req; body: <B = unknown>(body: B) => Req<B>; path: (path: Json) => Req; query: (query: Json) => Req; }; resp: { items: (status: HttpStatus, items?: unknown[]) => Response; errors: (status: HttpStatus, message: string, errors?: unknown[]) => Response; }; provider: { data: (...items: any[]) => { execute: jest.Mock; }; }; static readonly getArg: <T>(mock: unknown, call?: number, arg?: number) => T | undefined; clear: () => typeof jest; impl: (f?: (...args: any[]) => any) => jest.Mock; property: <T extends object, P extends jest.NonFunctionPropertyNames<Required<T>>>(object: T, getter: P, value: T[P]) => jest.SpyInstance; reject: (value?: unknown) => jest.Mock; rejectWith: <T = any>(props?: Partial<T>) => jest.Mock; resolve: (value?: unknown) => jest.Mock; resolveWith: <T = any>(props?: Partial<T>) => jest.Mock; return: (value?: unknown) => jest.Mock; returnWith: <T = any>(props?: Partial<T>) => jest.Mock; this: () => jest.Mock; empty: <T = any>(props?: Partial<T>) => T; a: <T = any>(props?: Partial<T>) => T; an: <T = any>(props?: Partial<T>) => T; date: (epoch?: number) => Date; once: (...values: unknown[]) => jest.Mock; } export declare const mock: Mocks;