mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-03-15 16:51:02 +00:00
22 lines
424 B
JavaScript
22 lines
424 B
JavaScript
/* eslint-disable valid-jsdoc */
|
|
'use strict'
|
|
|
|
const chai = require('chai')
|
|
const expect = chai.expect
|
|
|
|
// @ts-check
|
|
/**
|
|
* @type {function(any, string): Promise<void>}
|
|
*/
|
|
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 }
|