@ngneat/spectator
Version:
A powerful tool to simplify your Angular tests
15 lines (14 loc) • 683 B
TypeScript
import { FactoryProvider, AbstractType, Type } from '@angular/core';
import { SpyObject as BaseSpyObject } from '@ngneat/spectator';
import { jest } from '@jest/globals';
export type SpyObject<T> = BaseSpyObject<T> & {
[P in keyof T]: T[P] & (T[P] extends (...args: any[]) => infer R ? (R extends (...args: any[]) => any ? jest.Mock<R> : jest.Mock<T[P]>) : T[P]);
};
/**
* @publicApi
*/
export declare function createSpyObject<T>(type: Type<T> | AbstractType<T>, template?: Partial<Record<keyof T, any>>): SpyObject<T>;
/**
* @publicApi
*/
export declare function mockProvider<T>(type: Type<T> | AbstractType<T>, properties?: Partial<Record<keyof T, any>>): FactoryProvider;