Files
core/library/sodium-plus/test/async-helper.js
2024-03-10 22:38:21 +00:00

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');
}
};