From 74f71230d8137adcc05c2dae036b33ed225fb4d9 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 30 Oct 2017 17:52:38 -0300 Subject: [PATCH] add TWO_STEP_CREATION_HOURS default --- test/integration/server.js | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/integration/server.js b/test/integration/server.js index 8391ea2..8958e4e 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -2280,6 +2280,58 @@ describe('Wallet service', function() { done(); }); }); + + + it.only('should not perform 2 steps after 2 steps was just triggered', function(done) { + var oldAddrs, newAddrs; + Defaults.TWO_STEP_BALANCE_THRESHOLD = 5; + + async.series([ + + function(next) { + helpers.createAddresses(server, wallet, 2, 0, function(addrs) { + oldAddrs = addrs; + next(); + }); + }, + function(next) { + clock.tick(7 * Defaults.TWO_STEP_CREATION_HOURS * 3600 * 1000); + helpers.createAddresses(server, wallet, 2, 0, function(addrs) { + newAddrs = addrs; + helpers.stubUtxos(server, wallet, [1, 2], { + addresses: [oldAddrs[0], newAddrs[0]], + }, function() { + next(); + }); + }); + }, + function(next) { + server.getBalance({ + twoStep: true + }, function(err, balance) { + should.not.exist(err); + should.exist(balance); + balance.totalAmount.should.equal(helpers.toSatoshi(3)); + next(); + }); + }, + function(next) { + setTimeout(next, 100); + }, + function(next) { + server.getNotifications({}, function(err, notifications) { + should.not.exist(err); + var last = _.last(notifications); + last.type.should.not.equal('BalanceUpdated'); + next(); + }); + }, + ], function(err) { + should.not.exist(err); + done(); + }); + }); + }); describe('#getFeeLevels', function() {