Use for this testing pattern:
try { await call() assert.fail("this should never happen"); } catch (e) { ... } Just do this try { await shouldThrow(call()); // If this succeeds unexpectedResultError is thrown. } catch(e) { ... } Copy
try { await call() assert.fail("this should never happen"); } catch (e) { ... } Just do this try { await shouldThrow(call()); // If this succeeds unexpectedResultError is thrown. } catch(e) { ... }
The async function that is expected to throw.
Optional
Use for this testing pattern: