mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-06-26 19:01:50 +00:00
feat: add typescript types + linting/tests (#161)
* 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>
This commit is contained in:
committed by
Jacob Heun
parent
b5d94ecae7
commit
e01977c5a3
@ -10,8 +10,14 @@ const crypto = require('../src')
|
||||
const fixtures = require('./fixtures/go-key-rsa')
|
||||
const { expectErrCode } = require('./util')
|
||||
|
||||
/** @typedef {import("libp2p-crypto").PrivateKey} PrivateKey */
|
||||
|
||||
describe('libp2p-crypto', function () {
|
||||
this.timeout(20 * 1000)
|
||||
// @ts-check
|
||||
/**
|
||||
* @type {PrivateKey}
|
||||
*/
|
||||
let key
|
||||
before(async () => {
|
||||
key = await crypto.keys.generateKeyPair('RSA', 512)
|
||||
@ -109,9 +115,9 @@ describe('libp2p-crypto', function () {
|
||||
})
|
||||
|
||||
describe('randomBytes', () => {
|
||||
it('throws with no number passed', () => {
|
||||
it('throws with invalid number passed', () => {
|
||||
expect(() => {
|
||||
crypto.randomBytes()
|
||||
crypto.randomBytes(-1)
|
||||
}).to.throw()
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user