mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-06-27 16:01:47 +00:00
fix(utils): make util.toBase64
browserify compatible
`bn.toArrayLike` is used instead of `bn.toBuffer`, to ensure compatibility with browserify.
This commit is contained in:
committed by
Friedel Ziegelmayer
parent
a4e6f9dd83
commit
933119445f
21
test/util.spec.js
Normal file
21
test/util.spec.js
Normal file
@ -0,0 +1,21 @@
|
||||
/* eslint max-nested-callbacks: ["error", 8] */
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const expect = require('chai').expect
|
||||
const util = require('../src/crypto/util')
|
||||
const BN = require('bn.js')
|
||||
|
||||
describe('Util', () => {
|
||||
let bn
|
||||
|
||||
before((done) => {
|
||||
bn = new BN('dead', 16)
|
||||
done()
|
||||
})
|
||||
|
||||
it('toBase64', (done) => {
|
||||
expect(util.toBase64(bn)).to.be.eql('3q0')
|
||||
done()
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user