tests: use safe-buffers throughout

This commit is contained in:
Daniel Cousens 2017-04-19 17:39:16 +10:00 committed by Daniel Cousens
parent aeb0312d63
commit f1ab151c31
20 changed files with 88 additions and 94 deletions

View file

@ -36,8 +36,7 @@ describe('HDNode', function () {
var d = BigInteger.ONE
keyPair = new ECPair(d, null)
chainCode = new Buffer(32)
chainCode.fill(1)
chainCode = Buffer.alloc(32, 1)
})
it('stores the keyPair/chainCode directly', function () {
@ -64,7 +63,7 @@ describe('HDNode', function () {
it('throws when an invalid length chain code is given', function () {
assert.throws(function () {
new HDNode(keyPair, new Buffer(20))
new HDNode(keyPair, Buffer.alloc(20))
}, /Expected property "1" of type Buffer\(Length: 32\), got Buffer\(Length: 20\)/)
})
})
@ -116,9 +115,9 @@ describe('HDNode', function () {
beforeEach(function () {
keyPair = ECPair.makeRandom()
hash = new Buffer(32)
hash = Buffer.alloc(32)
var chainCode = new Buffer(32)
var chainCode = Buffer.alloc(32)
hd = new HDNode(keyPair, chainCode)
})