From 7d15b2bf0f0db3a8aa61b71d0003a072cf119028 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Wed, 17 Dec 2014 12:34:21 -0500 Subject: [PATCH] Private Key: Fix bug with tests and missing "new" --- lib/privatekey.js | 2 +- test/privatekey.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/privatekey.js b/lib/privatekey.js index a16ef08..eaecd00 100644 --- a/lib/privatekey.js +++ b/lib/privatekey.js @@ -157,7 +157,7 @@ PrivateKey._transformBuffer = function(buf, network) { } if (network && info.network !== Networks.get(network)) { - throw TypeError('Private key network mismatch'); + throw new TypeError('Private key network mismatch'); } info.bn = BN.fromBuffer(buf.slice(1, 32 + 1)); diff --git a/test/privatekey.js b/test/privatekey.js index e0dd4bd..6fe249d 100644 --- a/test/privatekey.js +++ b/test/privatekey.js @@ -90,7 +90,7 @@ describe('PrivateKey', function() { it('should not be able to instantiate private key WIF because of unknown network byte', function() { expect(function() { var buf = base58check.decode('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m'); - var buf2 = Buffer.concat([new Buffer(0x01, 'hex'), buf.slice(1, 33)]); + var buf2 = Buffer.concat([new Buffer('ff', 'hex'), buf.slice(1, 33)]); var a = new PrivateKey(buf2); }).to.throw('Invalid network'); });