import { createMock } from 'ts-auto-mock' ; import { method , On } from 'ts-auto-mock/extension' ; describe ( 'names' , ( ) => { it ( 'should give a name to the spy' , ( ) => { interface Interface { a ( ) : string ; b : ( ) => string ; } const mock = createMock < Interface > ( ) ; const spyA = On ( mock ) . get ( method ( ( x ) => x . a ) ) ; const spyB = On ( mock ) . get ( method ( ( x ) => x . b ) ) ; expect ( spyA . and . identity ) . toBe ( 'a' ) ; expect ( spyB . and . identity ) . toBe ( 'b' ) ; } ) ; } ) ;