rm getNotifications

This commit is contained in:
Ivan Socolsky 2015-10-15 15:18:11 -03:00
parent b23f412bf3
commit 3bb097c7f4
2 changed files with 27 additions and 27 deletions

View File

@ -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).
*

View File

@ -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);