import { assert } from './assert' ; test ( 'TypeScript "asserts condition"' , ( ) => { const foobar = ( ) : number | string => 'foobar' ; const str = foobar ( ) ; assert ( typeof str === 'string' ) ; str . includes ( 'foo' ) ; } ) ; test ( 'console output' , ( ) => { expect . assertions ( 4 ) ; const consoleSpy = jest . spyOn ( console , 'assert' ) . mockImplementation ( ) ; assert ( false ) ; expect ( consoleSpy ) . toHaveBeenCalledTimes ( 1 ) ; expect ( consoleSpy ) . toHaveBeenCalledWith ( false ) ; assert ( false , 'a message' ) ; expect ( consoleSpy ) . toHaveBeenCalledTimes ( 2 ) ; expect ( consoleSpy ) . toHaveBeenCalledWith ( false , 'a message' ) ; consoleSpy . mockRestore ( ) ; } ) ;