export async function expectAsyncError ( check , expectedError ) { let error ; try { await check ( ) ; } catch ( e ) { error = e ; } expect ( error ) . toEqual ( expectedError ) ; } export async function expectNoAsyncError ( check ) { let error ; try { await check ( ) ; } catch ( e ) { error = e ; } if ( error ) console . log ( 'Received async error although expected no error: ' , error ) ; expect ( error ) . toEqual ( undefined ) ; }