import { SpyAdapter } from './spy-adapter' ; export class JestAdapter implements SpyAdapter { getSpy ( ) { return jest . fn ( ) ; } spyAndCallFake < T , K extends keyof T > ( object , key , stub ) { jest . spyOn ( object , key ) . mockImplementation ( stub as any ) ; ( object [ key ] as any ) . mockClear ( ) ; } spyAndCallThrough < T , K extends keyof T > ( object , key ) { if ( typeof object [ key ] === typeof Function ) { jest . spyOn ( object , key ) ; } } }