UNPKG

@thisisagile/easy-test

Version:

Straightforward library for testing microservices built with @thisisagile/easy

37 lines (36 loc) 1.29 kB
/// <reference types="jest" /> import NonFunctionPropertyNames = jest.NonFunctionPropertyNames; import SpyInstance = jest.SpyInstance; import Mock = jest.Mock; import { Id, Json } from '../utils/Types'; import { Req } from '../utils/Req'; import { HttpStatus, Response } from '../utils/Response'; export declare const mock: { clear: typeof jest; impl: (f?: ((...args: any[]) => any) | undefined) => Mock; property: <T, P extends NonFunctionPropertyNames<Required<T>>>(object: T, getter: P, value: T[P]) => SpyInstance; reject: (value?: unknown) => Mock; req: { id: (id: Id) => Req; q: (q: unknown) => Req; with: (a: Json) => Req; body: (body: unknown) => Req; path: (path: Json) => Req; query: (query: Json) => Req; }; resp: { items: (status: HttpStatus, items?: unknown[]) => Response; errors: (status: HttpStatus, message: string, errors?: unknown[]) => Response; }; resolve: (value?: unknown) => Mock; return: (value?: unknown) => Mock; this: () => Mock; provider: { data: (...items: any[]) => { execute: Mock; }; }; empty: <T_1 = any>(props?: any) => T_1; date: (epoch?: number) => Date; once: (...values: unknown[]) => Mock; };