import { createMock } from 'ts-auto-mock' ; describe ( 'Random number' , ( ) => { it ( 'should be generated by math random' , ( ) => { type WithNumber = { propertyName : number ; } ; const spy = spyOn ( Math , 'random' ) ; spy . and . returnValue ( 1 ) ; const mock = createMock < WithNumber > ( ) ; expect ( mock . propertyName ) . toBe ( 10000 ) ; spy . calls . reset ( ) ; spy . and . returnValue ( 0 ) ; const mock2 = createMock < WithNumber > ( ) ; expect ( mock2 . propertyName ) . toBe ( - 10000 ) ; } ) ; } ) ;