import { expect } from 'chai' ; export const shouldThrow = async ( async_fn , message ) => { const logs = [ ] ; try { console . _log = console . log ; console . log = ( ... args ) => logs . push ( ... args ) ; await async_fn ( ) ; console . log = console . _log ; throw new Error ( 'Should have thrown!' ) ; } catch ( err ) { console . log = console . _log ; expect ( logs . join ( '' ) ) . to . contain ( message ) ; } } ;