aboutsummaryrefslogblamecommitdiffstats
path: root/library/sodium-plus/test/async-helper.js
blob: d3b5ebc000ea8edc3ecc86778181f733f370b05f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












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