mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-03-31 04:01:17 +00:00
* feat: adds typescript types + linting/tests Signed-off-by: Carson Farmer <carson.farmer@gmail.com> * feat: much better types testing Signed-off-by: Carson Farmer <carson.farmer@gmail.com> * chore: revert eslintignore Signed-off-by: Carson Farmer <carson.farmer@gmail.com> * feat: update types entry Signed-off-by: Carson Farmer <carson.farmer@gmail.com> * chore: exclude has no effect here Signed-off-by: Carson Farmer <carson.farmer@gmail.com> * feat: more nuanced return types on keypair Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
22 lines
415 B
JavaScript
22 lines
415 B
JavaScript
/* eslint-disable valid-jsdoc */
|
|
'use strict'
|
|
|
|
const chai = require('chai')
|
|
const expect = chai.expect
|
|
|
|
// @ts-check
|
|
/**
|
|
* @type {function(any, string): 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 }
|