Private Key: Fix bug with tests and missing "new"

This commit is contained in:
Braydon Fuller 2014-12-17 12:34:21 -05:00
parent 77b6ce3f9e
commit 7d15b2bf0f
2 changed files with 2 additions and 2 deletions

View File

@ -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));

View File

@ -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');
});