mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-04-09 16:06:14 +00:00
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 }
|