mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 03:35:13 +00:00
13 lines
333 B
JavaScript
13 lines
333 B
JavaScript
const { expect } = require('chai');
|
|
module.exports = async function expectError(promised, message) {
|
|
let thrown = false;
|
|
try {
|
|
await promised;
|
|
} catch (e) {
|
|
thrown = true;
|
|
expect(message).to.be.equal(e.message);
|
|
}
|
|
if (!thrown) {
|
|
throw new Error('Function did not throw');
|
|
}
|
|
};
|