gambit
Version:
A hyper-thin library to help building API driven redux apps
17 lines (14 loc) • 324 B
JavaScript
import { expect } from 'chai';
export default async function asyncThrow(method, shouldThrow = true) {
try {
await method();
} catch (e) {
if (!shouldThrow) {
expect('Not throw an Error').to.equal(false);
}
return true;
}
if (shouldThrow) {
expect('Throw an Error').to.equal(false);
}
}