UNPKG

@hirez_io/auto-spies-core

Version:

Create automatic spies from classes in tests, also for promises and observables, used as a common code for jasmine-auto-spies and jest-auto-spies

13 lines (12 loc) 770 B
import { AccessorSpyFactory, OnlyMethodKeysOf, OnlyObservablePropsOf, OnlyPropsOf } from '.'; export interface ClassSpyConfiguration<T> { methodsToSpyOn?: OnlyMethodKeysOf<T>[]; observablePropsToSpyOn?: OnlyObservablePropsOf<T>[]; settersToSpyOn?: OnlyPropsOf<T>[]; gettersToSpyOn?: OnlyPropsOf<T>[]; providedMethodNames?: OnlyMethodKeysOf<T>[]; } export declare function createAutoSpyFromClass<T, AutoSpyType, FrameworkSpecificFunctionSpy, FunctionAutoSpyType>(ObjectClass: { new (...args: any[]): T; [key: string]: any; }, createFunctionSpy: (name: string) => FunctionAutoSpyType, accessorSpyFactory: AccessorSpyFactory<FrameworkSpecificFunctionSpy>, methodsToSpyOnOrConfig?: OnlyMethodKeysOf<T>[] | ClassSpyConfiguration<T>): AutoSpyType;