From 3bb097c7f461c3616711b1cf051c26689d863a94 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 15 Oct 2015 15:18:11 -0300 Subject: [PATCH] rm getNotifications --- lib/server.js | 18 ------------------ test/integration/server.js | 36 +++++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/server.js b/lib/server.js index bd01531..18a250b 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1640,24 +1640,6 @@ WalletService.prototype.getTxs = function(opts, cb) { }; -/** - * Retrieves notifications in the range (maxTs-minTs). - * Times are in UNIX EPOCH. Order is assured even for events with the same time - * - * @param {Object} opts.minTs (defaults to 0) - * @param {Object} opts.maxTs (defaults to now) - * @param {Object} opts.limit - * @param {Object} opts.reverse (default false) - * @returns {Notification[]} Notifications - */ -WalletService.prototype.getNotifications = function(opts, cb) { - var self = this; - self.storage.fetchNotifications(self.walletId, opts, function(err, notifications) { - if (err) return cb(err); - return cb(null, notifications); - }); -}; - /** * Retrieves notifications after a specific id or from a given ts (whichever is more recent). * diff --git a/test/integration/server.js b/test/integration/server.js index b8be06b..66cb63f 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -1041,7 +1041,9 @@ describe('Wallet service', function() { copayer.name.should.equal('me'); copayer.id.should.equal(copayerId); copayer.customData.should.equal('dummy custom data'); - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var notif = _.find(notifications, { type: 'NewCopayer' @@ -1250,7 +1252,9 @@ describe('Wallet service', function() { should.not.exist(err); wallet.status.should.equal('complete'); wallet.publicKeyRing.length.should.equal(3); - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var notif = _.find(notifications, { type: 'WalletComplete' @@ -1265,7 +1269,9 @@ describe('Wallet service', function() { it('should not notify WalletComplete if 1-of-1', function(done) { helpers.createAndJoinWallet(1, 1, function(server) { - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var notif = _.find(notifications, { type: 'WalletComplete' @@ -1554,7 +1560,9 @@ describe('Wallet service', function() { address.isChange.should.be.false; address.path.should.equal('m/2147483647/0/0'); address.type.should.equal('P2SH'); - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var notif = _.find(notifications, { type: 'NewAddress' @@ -1617,7 +1625,9 @@ describe('Wallet service', function() { address.isChange.should.be.false; address.path.should.equal('m/0/0'); address.type.should.equal('P2SH'); - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var notif = _.find(notifications, { type: 'NewAddress' @@ -1684,7 +1694,9 @@ describe('Wallet service', function() { address.isChange.should.be.false; address.path.should.equal('m/0/0'); address.type.should.equal('P2PKH'); - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var notif = _.find(notifications, { type: 'NewAddress' @@ -3605,7 +3617,9 @@ describe('Wallet service', function() { txp.actions.length.should.equal(1); var action = txp.getActionBy(wallet.copayers[0].id); action.type.should.equal('accept'); - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var last = _.last(notifications); last.type.should.not.equal('TxProposalFinallyAccepted'); @@ -3635,7 +3649,9 @@ describe('Wallet service', function() { txp.isBroadcasted().should.be.false; should.exist(txp.txid); txp.actions.length.should.equal(2); - server.getNotifications({}, function(err, notifications) { + server.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); var last = _.last(notifications); last.type.should.equal('TxProposalFinallyAccepted'); @@ -4180,7 +4196,9 @@ describe('Wallet service', function() { }); }, function(next) { - server2.getNotifications({}, function(err, notifications) { + server2.getLatestNotifications({ + minTs: 0 + }, function(err, notifications) { should.not.exist(err); should.exist(notifications); notifications.length.should.above(0);