mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-06-23 20:01:50 +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:
@ -60,4 +60,14 @@ describe('generateEphemeralKeyPair', () => {
|
||||
expect(secrets[0]).to.have.length(32)
|
||||
})
|
||||
})
|
||||
|
||||
it(`handles bad curve name`, async () => {
|
||||
try {
|
||||
await crypto.keys.generateEphemeralKeyPair('bad name')
|
||||
} catch (err) {
|
||||
expect(err.code).equals('ERR_INVALID_CURVE')
|
||||
return
|
||||
}
|
||||
expect.fail('Did not throw error')
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user