mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-03-31 21:51:06 +00:00
* chore: add error codes * chore: create errors with new Error() * fix: better error testin * refactor: simplify random bytes error checks
17 lines
322 B
JavaScript
17 lines
322 B
JavaScript
'use strict'
|
|
|
|
const chai = require('chai')
|
|
const expect = chai.expect
|
|
|
|
const expectErrCode = async (p, code) => {
|
|
try {
|
|
await p
|
|
} catch (err) {
|
|
expect(err).to.have.property('code', code)
|
|
return
|
|
}
|
|
expect.fail(`Expected error with code ${code} but no error thrown`)
|
|
}
|
|
|
|
module.exports = { expectErrCode }
|