diff --git a/test/PublicKeyRing.js b/test/PublicKeyRing.js index 39f7d0491..e575e3e46 100644 --- a/test/PublicKeyRing.js +++ b/test/PublicKeyRing.js @@ -154,10 +154,24 @@ describe('PublicKeyRing model', function() { var pubkeyring = setup.w; var address = pubkeyring._getAddress(3, false, 4); - pubkeyring.cache.addressToPath[address].should.equal("m/45'/4/0/3"); - _.indexOf(pubkeyring.cache.receiveAddresses,address).should.be.above(0); - _.indexOf(pubkeyring.cache.changeAddresses,address).should.be.equal(-1); + }); + + it('cach4es calls to getAddress (2)', function() { + var setup = getCachedW(); + var pubkeyring = setup.w; + var address = pubkeyring.generateAddress(false, setup.pub); + _.indexOf(pubkeyring.getReceiveAddresses(),address).should.be.above(-1); + _.indexOf(pubkeyring.getAddresses(),address).should.be.above(-1); + }); + + + it('cach4es calls to getAddress (3)', function() { + var setup = getCachedW(); + var pubkeyring = setup.w; + var address = pubkeyring.generateAddress(true, setup.pub); + _.indexOf(pubkeyring.getReceiveAddresses(),address).should.be.equal(-1); + _.indexOf(pubkeyring.getAddresses(),address).should.be.above(-1); }); it('should generate one address by default', function() { diff --git a/test/Wallet.js b/test/Wallet.js index 90a243a36..45f843093 100644 --- a/test/Wallet.js +++ b/test/Wallet.js @@ -1972,7 +1972,7 @@ describe('Wallet model', function() { }); var spy = sinon.spy(w, 'emit'); - w._setBlockchainListeners(); + w._setupBlockchainHandlers(); spy.calledWith('tx', addr1, false).should.equal(true); }); @@ -1990,7 +1990,7 @@ describe('Wallet model', function() { }); var spy = sinon.spy(w, 'emit'); - w._setBlockchainListeners(); + w._setupBlockchainHandlers(); spy.calledWith('tx', addr1, true).should.equal(true); }); @@ -2531,7 +2531,7 @@ describe('Wallet model', function() { // DATA - var o = '{"opts":{"id":"dbfe10c3fae71cea", "spendUnconfirmed":1,"requiredCopayers":3,"totalCopayers":5,"version":"0.0.5","networkName":"testnet"},"networkNonce":"0000000000000001","networkNonces":[],"publicKeyRing":{ "cache": { "addressToPath": {}, "changeAddresses": [], "receiveAddresses": [] }, "walletId":"dbfe10c3fae71cea","networkName":"testnet","requiredCopayers":3,"totalCopayers":5,"indexes":[{"copayerIndex":2,"changeIndex":0,"receiveIndex":0}],"copayersExtPubKeys":["tpubD6NzVbkrYhZ4YGK8ZhZ8WVeBXNAAoTYjjpw9twCPiNGrGQYFktP3iVQkKmZNiFnUcAFMJRxJVJF6Nq9MDv2kiRceExJaHFbxUCGUiRhmy97","tpubD6NzVbkrYhZ4YKGDJkzWdQsQV3AcFemaQKiwNhV4RL8FHnBFvinidGdQtP8RKj3h34E65RkdtxjrggZYqsEwJ8RhhN2zz9VrjLnrnwbXYNc","tpubD6NzVbkrYhZ4YkDiewjb32Pp3Sz9WK2jpp37KnL7RCrHAyPpnLfgdfRnTdpn6DTWmPS7niywfgWiT42aJb1J6CjWVNmkgsMCxuw7j9DaGKB","tpubD6NzVbkrYhZ4XEtUAz4UUTWbprewbLTaMhR8NUvSJUEAh4Sidxr6rRPFdqqVRR73btKf13wUjds2i8vVCNo8sbKrAnyoTr3o5Y6QSbboQjk","tpubD6NzVbkrYhZ4Yj9AAt6xUVuGPVd8jXCrEE6V2wp7U3PFh8jYYvVad31b4VUXEYXzSnkco4fktu8r4icBsB2t3pCR3WnhVLedY2hxGcPFLKD"],"nicknameFor":{}},"txProposals":{"txps":[],"walletId":"dbfe10c3fae71cea","networkName":"testnet"},"privateKey":{"extendedPrivateKeyString":"tprv8ZgxMBicQKsPeoHLg3tY75z4xLeEe8MqAXLNcRA6J6UTRvHV8VZTXznt9eoTmSk1fwSrwZtMhY3XkNsceJ14h6sCXHSWinRqMSSbY8tfhHi","networkName":"testnet"},"addressBook":{},"settings":{"unitName":"BTC","unitToSatoshi":100000000,"unitDecimals":8,"alternativeName":"Argentine Peso","alternativeIsoCode":"ARS"}}'; + var o = '{"opts":{"id":"dbfe10c3fae71cea", "spendUnconfirmed":1,"requiredCopayers":3,"totalCopayers":5,"version":"0.0.5","networkName":"testnet"},"networkNonce":"0000000000000001","networkNonces":[],"publicKeyRing":{ "cache": { "addressToPath": {}}, "walletId":"dbfe10c3fae71cea","networkName":"testnet","requiredCopayers":3,"totalCopayers":5,"indexes":[{"copayerIndex":2,"changeIndex":0,"receiveIndex":0}],"copayersExtPubKeys":["tpubD6NzVbkrYhZ4YGK8ZhZ8WVeBXNAAoTYjjpw9twCPiNGrGQYFktP3iVQkKmZNiFnUcAFMJRxJVJF6Nq9MDv2kiRceExJaHFbxUCGUiRhmy97","tpubD6NzVbkrYhZ4YKGDJkzWdQsQV3AcFemaQKiwNhV4RL8FHnBFvinidGdQtP8RKj3h34E65RkdtxjrggZYqsEwJ8RhhN2zz9VrjLnrnwbXYNc","tpubD6NzVbkrYhZ4YkDiewjb32Pp3Sz9WK2jpp37KnL7RCrHAyPpnLfgdfRnTdpn6DTWmPS7niywfgWiT42aJb1J6CjWVNmkgsMCxuw7j9DaGKB","tpubD6NzVbkrYhZ4XEtUAz4UUTWbprewbLTaMhR8NUvSJUEAh4Sidxr6rRPFdqqVRR73btKf13wUjds2i8vVCNo8sbKrAnyoTr3o5Y6QSbboQjk","tpubD6NzVbkrYhZ4Yj9AAt6xUVuGPVd8jXCrEE6V2wp7U3PFh8jYYvVad31b4VUXEYXzSnkco4fktu8r4icBsB2t3pCR3WnhVLedY2hxGcPFLKD"],"nicknameFor":{}},"txProposals":{"txps":[],"walletId":"dbfe10c3fae71cea","networkName":"testnet"},"privateKey":{"extendedPrivateKeyString":"tprv8ZgxMBicQKsPeoHLg3tY75z4xLeEe8MqAXLNcRA6J6UTRvHV8VZTXznt9eoTmSk1fwSrwZtMhY3XkNsceJ14h6sCXHSWinRqMSSbY8tfhHi","networkName":"testnet"},"addressBook":{},"settings":{"unitName":"BTC","unitToSatoshi":100000000,"unitDecimals":8,"alternativeName":"Argentine Peso","alternativeIsoCode":"ARS"}}'; }); diff --git a/test/mocks/FakeBlockchain.js b/test/mocks/FakeBlockchain.js index 6af0cc8e3..be2483dcf 100644 --- a/test/mocks/FakeBlockchain.js +++ b/test/mocks/FakeBlockchain.js @@ -17,6 +17,9 @@ FakeBlockchain.prototype.getTransactions = function(addresses, from, to, cb) { FakeBlockchain.prototype.subscribe = function() { }; +FakeBlockchain.prototype.on = function() { +}; + FakeBlockchain.prototype.fixUnspent = function(u) { this.u = u; };