// This saves time by shortening the repetitive syntax of providing // an auto spy in Angular tests. import { ClassType, OnlyMethodKeysOf } from '@hirez_io/auto-spies-core'; import { ClassSpyConfiguration, createSpyFromClass } from './create-spy-from-class'; import { Spy } from './jest-auto-spies.types'; export type AngularValueProvider = { provide: ClassType; useValue: Spy; }; export function provideAutoSpy( ObjectClass: ClassType, methodsToSpyOnOrConfig?: OnlyMethodKeysOf[] | ClassSpyConfiguration ): AngularValueProvider { return { provide: ObjectClass, useValue: createSpyFromClass(ObjectClass, methodsToSpyOnOrConfig), }; }