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