From 9da16decfa9b8edc2e0102dbe1e58f0b9cc342f2 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Sat, 21 Feb 2015 13:17:43 -0300 Subject: [PATCH] change notification tests to resist varying nb of address creation --- test/integration/server.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/integration/server.js b/test/integration/server.js index d3db9a5..45a20bb 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -1452,40 +1452,40 @@ describe('Copay server', function() { }); }); - it('should pull the last 5 notifications after 3 TXs', function(done) { + it('should pull the last 4 notifications after 3 TXs', function(done) { server.getNotifications({ - limit: 5, + limit: 4, reverse: true, }, function(err, notifications) { should.not.exist(err); var types = _.pluck(notifications, 'type'); - types.should.deep.equal(['NewTxProposal', 'NewTxProposal', 'NewTxProposal', 'NewAddress', 'NewAddress']); + types.should.deep.equal(['NewTxProposal', 'NewTxProposal', 'NewTxProposal', 'NewAddress']); done(); }); }); - it('should pull the last 5 notifications, using now', function(done) { + it('should pull the last 4 notifications, using now', function(done) { server.getNotifications({ - limit: 5, + limit: 4, reverse: true, maxTs: Date.now() / 1000, minTs: Date.now() / 1000 - 1000, }, function(err, notifications) { should.not.exist(err); var types = _.pluck(notifications, 'type'); - types.should.deep.equal(['NewTxProposal', 'NewTxProposal', 'NewTxProposal', 'NewAddress', 'NewAddress']); + types.should.deep.equal(['NewTxProposal', 'NewTxProposal', 'NewTxProposal', 'NewAddress']); done(); }); }); - it('should pull the first 5 notifications after wallet creation', function(done) { + it('should pull all notifications after wallet creation', function(done) { server.getNotifications({ minTs: 0, - limit: 5 }, function(err, notifications) { should.not.exist(err); var types = _.pluck(notifications, 'type'); - types.should.deep.equal(['NewCopayer', 'NewAddress', 'NewAddress', 'NewAddress', 'NewTxProposal']); + types[0].should.equal('NewCopayer'); + types[types.length - 1].should.equal('NewTxProposal'); done(); }); });