mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-06-23 05:41:52 +00:00
chore: add error codes (#155)
* chore: add error codes * chore: create errors with new Error() * fix: better error testin * refactor: simplify random bytes error checks
This commit is contained in:
16
test/util/index.js
Normal file
16
test/util/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
'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 }
|
Reference in New Issue
Block a user