|
|
@ -5453,7 +5453,7 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('Subscribe/unsubscribe', function() { |
|
|
|
describe.only('Subscribe/unsubscribe', function() { |
|
|
|
var server, wallet; |
|
|
|
beforeEach(function(done) { |
|
|
|
helpers.createAndJoinWallet(2, 3, function(s, w) { |
|
|
@ -5467,7 +5467,9 @@ describe('Wallet service', function() { |
|
|
|
request.yields(); |
|
|
|
helpers.getAuthServer(wallet.copayers[0].id, function(server) { |
|
|
|
should.exist(server); |
|
|
|
server.pushNotificationsSubscribe({}, function(err, response) { |
|
|
|
server.pushNotificationsSubscribe({ |
|
|
|
token: 'DEVICE_TOKEN' |
|
|
|
}, function(err, response) { |
|
|
|
should.not.exist(err); |
|
|
|
var calls = request.getCalls(); |
|
|
|
calls.length.should.equal(1); |
|
|
@ -5475,6 +5477,8 @@ describe('Wallet service', function() { |
|
|
|
return c.args[0]; |
|
|
|
}); |
|
|
|
args[0].body.user.should.contain(wallet.copayers[0].id); |
|
|
|
args[0].body.user.should.contain(wallet.id); |
|
|
|
args[0].body.user.should.contain('DEVICE_TOKEN'); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -5484,7 +5488,7 @@ describe('Wallet service', function() { |
|
|
|
request.yields(); |
|
|
|
helpers.getAuthServer(wallet.copayers[0].id, function(server) { |
|
|
|
should.exist(server); |
|
|
|
server.pushNotificationsUnsubscribe(null, function(err, response) { |
|
|
|
server.pushNotificationsUnsubscribe('DEVICE_TOKEN', function(err, response) { |
|
|
|
should.not.exist(err); |
|
|
|
var calls = request.getCalls(); |
|
|
|
calls.length.should.equal(1); |
|
|
@ -5493,24 +5497,8 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
|
|
|
|
args[0].body.user.should.contain(wallet.copayers[0].id); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should unsubscribe all wallets from device to push notifications service', function(done) { |
|
|
|
request.yields(); |
|
|
|
helpers.getAuthServer(wallet.copayers[0].id, function(server) { |
|
|
|
should.exist(server); |
|
|
|
server.pushNotificationsUnsubscribe('TOKEN_DEVICE', function(err, response) { |
|
|
|
should.not.exist(err); |
|
|
|
var calls = request.getCalls(); |
|
|
|
calls.length.should.equal(1); |
|
|
|
var args = _.map(calls, function(c) { |
|
|
|
return c.args[0]; |
|
|
|
}); |
|
|
|
|
|
|
|
args[0].body.token.should.contain('TOKEN_DEVICE'); |
|
|
|
args[0].body.user.should.contain(wallet.id); |
|
|
|
args[0].body.user.should.contain('DEVICE_TOKEN'); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|