mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
14 lines
333 B
JavaScript
14 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');
|
|
}
|
|
};
|