Skip to content

Commit

Permalink
Rename pushNotification to send
Browse files Browse the repository at this point in the history
  • Loading branch information
argon committed Aug 4, 2016
1 parent 5c28e3f commit d366d7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function(dependencies) {

Provider.prototype = Object.create(EventEmitter.prototype);

Provider.prototype.pushNotification = function pushNotification(notification, recipients) {
Provider.prototype.send = function send(notification, recipients) {
const builtNotification = {
headers: notification.headers(),
body: notification.compile(),
Expand Down
12 changes: 6 additions & 6 deletions test/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("Provider", function() {
});
});

describe("pushNotification", function () {
describe("send", function () {

describe("single notification behaviour", function () {
let provider;
Expand All @@ -57,14 +57,14 @@ describe("Provider", function() {
});

it("invokes the writer withe correct `this`", function () {
return provider.pushNotification(notificationDouble(), "abcd1234")
return provider.send(notificationDouble(), "abcd1234")
.then(function () {
expect(fakes.client.write).to.be.calledOn(fakes.client);
});
});

it("writes the notification to the client once", function () {
return provider.pushNotification(notificationDouble(), "abcd1234")
return provider.send(notificationDouble(), "abcd1234")
.then(function () {
const notification = notificationDouble();
const builtNotification = {
Expand All @@ -77,7 +77,7 @@ describe("Provider", function() {
});

it("resolves with the device token in the sent array", function () {
return expect(provider.pushNotification(notificationDouble(), "abcd1234"))
return expect(provider.send(notificationDouble(), "abcd1234"))
.to.become({ sent: [{"device": "abcd1234"}], failed: []});
});
});
Expand All @@ -89,7 +89,7 @@ describe("Provider", function() {
const provider = new Provider( { address: "testapi" } );

fakes.client.write.onCall(0).returns(Promise.resolve({ device: "abcd1234", status: "400", response: { reason: "BadDeviceToken" }}));
promise = provider.pushNotification(notificationDouble(), "abcd1234");
promise = provider.send(notificationDouble(), "abcd1234");
});

it("resolves with the device token, status code and response in the failed array", function () {
Expand Down Expand Up @@ -122,7 +122,7 @@ describe("Provider", function() {
fakes.client.write.onCall(3).returns(fakes.resolutions[3]);
fakes.client.write.onCall(4).returns(fakes.resolutions[4]);

promise = provider.pushNotification(notificationDouble(), ["abcd1234", "adfe5969", "abcd1335", "bcfe4433", "aabbc788"]);
promise = provider.send(notificationDouble(), ["abcd1234", "adfe5969", "abcd1335", "bcfe4433", "aabbc788"]);

return promise;
});
Expand Down

0 comments on commit d366d7c

Please sign in to comment.