import { SpyAdapter } from './spy-adapter' ; export class JasmineAdapter implements SpyAdapter { getSpy ( property ) { return jasmine . createSpy ( property ) ; } spyAndCallFake < T , K extends keyof T > ( object , key , stub ) { const value = object [ key ] ; const spy = ( ( jasmine as any ) . isSpy ( value ) ? value : spyOn ( object , key ) ) as jasmine . Spy ; spy . calls . reset ( ) ; spy . and . callFake ( stub ) ; } spyAndCallThrough < T , K extends keyof T > ( object , key ) { const value = object [ key ] ; if ( typeof value === typeof Function && ! ( jasmine as any ) . isSpy ( value ) ) { spyOn ( object , key ) . and . callThrough ( ) ; } } }