From 13350d21b355dcde72b8725ae8994d4a77675776 Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Tue, 17 Jun 2014 09:39:41 -0700 Subject: [PATCH] fix more tests broken in last rebase --- test/test.PublicKeyRing.js | 23 +++++++++++++++++++---- test/test.TxProposals.js | 6 +++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/test/test.PublicKeyRing.js b/test/test.PublicKeyRing.js index b4c541178..06776761a 100644 --- a/test/test.PublicKeyRing.js +++ b/test/test.PublicKeyRing.js @@ -15,10 +15,6 @@ var PublicKeyRing = copay.PublicKeyRing; var aMasterPubKey = 'tprv8ZgxMBicQKsPdSVTiWXEqCCzqRaRr9EAQdn5UVMpT9UHX67Dh1FmzEMbavPumpAicsUm2XvC6NTdcWB89yN5DUWx5HQ7z3KByUg7Ht74VRZ'; -var config = { - networkName:'livenet', -}; - var createW = function (networkName) { var config = { networkName: networkName || 'livenet', @@ -41,6 +37,10 @@ var createW = function (networkName) { describe('PublicKeyRing model', function() { it('should create an instance (livenet)', function () { + var config = { + networkName:'livenet', + }; + var w = new PublicKeyRing({ networkName: config.networkName }); @@ -54,6 +54,9 @@ describe('PublicKeyRing model', function() { }); it('should fail to generate shared pub keys wo extended key', function () { + var config = { + networkName:'livenet', + }; var w2 = new PublicKeyRing(config); should.exist(w2); @@ -239,6 +242,9 @@ describe('PublicKeyRing model', function() { it('#merge pubkey tests', function () { + var config = { + networkName:'livenet', + }; var w = new PublicKeyRing(config); should.exist(w); var copayers = []; @@ -268,6 +274,9 @@ describe('PublicKeyRing model', function() { }); it('#merge pubkey tests (case 2)', function () { + var config = { + networkName:'livenet', + }; var w = new PublicKeyRing(config); should.exist(w); @@ -285,6 +294,9 @@ describe('PublicKeyRing model', function() { it('#merge with nickname', function () { + var config = { + networkName:'livenet', + }; var w = new PublicKeyRing(config); should.exist(w); for(var i=0; i<3; i++) { @@ -319,6 +331,9 @@ describe('PublicKeyRing model', function() { it('#toObj #fromObj with nickname', function () { + var config = { + networkName:'livenet', + }; var w = new PublicKeyRing(config); should.exist(w); for(var i=0; i<3; i++) { diff --git a/test/test.TxProposals.js b/test/test.TxProposals.js index d95c20370..00df86166 100644 --- a/test/test.TxProposals.js +++ b/test/test.TxProposals.js @@ -7,7 +7,7 @@ var Transaction = bitcore.Transaction; var buffertools = bitcore.buffertools; var WalletKey = bitcore.WalletKey; var Key = bitcore.Key; -var bignum = bitcore.bignum; +var bignum = bitcore.Bignum; var Script = bitcore.Script; var Builder = bitcore.TransactionBuilder; var util = bitcore.util; @@ -20,11 +20,11 @@ try { var fakeStorage = copay.FakeStorage; var PrivateKey = copay.PrivateKey || require('../js/models/PrivateKey'); var TxProposals = copay.TxProposals || require('../js/models/TxProposal'); +var is_browser = (typeof process == 'undefined' || typeof process.versions === 'undefined') var PublicKeyRing = is_browser ? copay.PublicKeyRing : require('soop').load('../js/models/core/PublicKeyRing', { Storage: fakeStorage }); -var is_browser = (typeof process.versions === 'undefined') var config = { networkName: 'testnet', @@ -106,7 +106,7 @@ describe('TxProposals model', function() { tx = b.build(); tx.isComplete().should.equal(true); - var s = new Script(new Buffer(unspentTest[0].scriptPubKey, 'hex')); + var s = new Script(new bitcore.Buffer(unspentTest[0].scriptPubKey, 'hex')); tx.verifyInput(0, s, { verifyP2SH: true,