Skip to content

Commit b04de1a

Browse files
committed
Fix linter and formatting after rebase
1 parent c59122d commit b04de1a

File tree

3 files changed

+44
-49
lines changed

3 files changed

+44
-49
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,15 @@ pushNotifications.send(tokens, notifications, (error, result) => {
581581
`fcm_notification` - object that will be **merged** with the notification fields. This allows you to override specific notification properties (like `channelId`, `ttl`, etc.) without duplicating standard fields like `title` and `body`.
582582
583583
For example, to set a channel ID for Android:
584+
584585
```js
585586
const data = {
586-
title: 'My Title',
587-
body: 'My Message',
587+
title: "My Title",
588+
body: "My Message",
588589
fcm_notification: {
589-
channelId: 'my-channel-id'
590+
channelId: "my-channel-id",
590591
},
591-
custom: { id: 123 }
592+
custom: { id: 123 },
592593
};
593594
```
594595

test/send/sendFCM.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ describe("push-notifications-fcm", () => {
7777
});
7878
});
7979

80-
describe('send push notifications with custom data', () => {
80+
describe("send push notifications with custom data", () => {
8181
const customDataMessage = {
82-
title: 'Notification Title',
83-
body: 'Notification Body',
82+
title: "Notification Title",
83+
body: "Notification Body",
8484
custom: {
85-
userId: '12345',
86-
actionId: 'action-001',
87-
deepLink: 'app://section/item',
85+
userId: "12345",
86+
actionId: "action-001",
87+
deepLink: "app://section/item",
8888
},
8989
};
9090

@@ -93,7 +93,7 @@ describe("push-notifications-fcm", () => {
9393
function sendCustomDataMethod() {
9494
return sinon.stub(
9595
fbMessaging.prototype,
96-
'sendEachForMulticast',
96+
"sendEachForMulticast",
9797
function sendFCMWithCustomData(firebaseMessage) {
9898
const { custom } = customDataMessage;
9999

@@ -103,8 +103,8 @@ describe("push-notifications-fcm", () => {
103103
// Verify custom data does NOT pollute the notification
104104
// Note: normalizeDataParams converts all values to strings (FCM requirement)
105105
expect(firebaseMessage.android.data).to.deep.equal(custom);
106-
expect(firebaseMessage.android.data).to.not.have.property('title');
107-
expect(firebaseMessage.android.data).to.not.have.property('body');
106+
expect(firebaseMessage.android.data).to.not.have.property("title");
107+
expect(firebaseMessage.android.data).to.not.have.property("body");
108108

109109
// Verify notification has proper fields (separate from data)
110110
expect(firebaseMessage.android.notification).to.include({
@@ -129,11 +129,11 @@ describe("push-notifications-fcm", () => {
129129
customDataSendMethod.restore();
130130
});
131131

132-
it('custom data should be preserved and not mixed with notification fields', (done) => {
132+
it("custom data should be preserved and not mixed with notification fields", (done) => {
133133
pn.send(regIds, customDataMessage)
134134
.then((results) => {
135-
expect(results).to.be.an('array');
136-
expect(results[0].method).to.equal('fcm');
135+
expect(results).to.be.an("array");
136+
expect(results[0].method).to.equal("fcm");
137137
expect(results[0].success).to.equal(1);
138138
done();
139139
})

test/send/sendGCM.js

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -788,54 +788,48 @@ describe("push-notifications-gcm", () => {
788788
});
789789
});
790790

791-
describe('fcm_notification partial override (merge)', () => {
791+
describe("fcm_notification partial override (merge)", () => {
792792
before(() => {
793-
sendMethod = sinon.stub(
794-
gcm.Sender.prototype,
795-
'send',
796-
(message, recipients, retries, cb) => {
797-
expect(recipients).to.be.instanceOf(Object);
798-
expect(message).to.be.instanceOf(gcm.Message);
799-
// Verify that title and body from main data are preserved
800-
expect(message.params.notification.title).to.equal(data.title);
801-
expect(message.params.notification.body).to.equal(data.body);
802-
// Verify that fcm_notification overrides are applied
803-
expect(message.params.notification.color).to.equal('#FF0000');
804-
// Verify custom data is present
805-
expect(message.params.data.sender).to.equal(data.custom.sender);
806-
807-
cb(null, {
808-
multicast_id: 'abc',
809-
success: recipients.registrationTokens.length,
810-
failure: 0,
811-
results: recipients.registrationTokens.map((token) => ({
812-
message_id: '',
813-
registration_id: token,
814-
error: null,
815-
})),
816-
});
817-
}
818-
);
793+
sendMethod = sinon.stub(gcm.Sender.prototype, "send", (message, recipients, retries, cb) => {
794+
expect(recipients).to.be.instanceOf(Object);
795+
expect(message).to.be.instanceOf(gcm.Message);
796+
// Verify that title and body from main data are preserved
797+
expect(message.params.notification.title).to.equal(data.title);
798+
expect(message.params.notification.body).to.equal(data.body);
799+
// Verify that fcm_notification overrides are applied
800+
expect(message.params.notification.color).to.equal("#FF0000");
801+
// Verify custom data is present
802+
expect(message.params.data.sender).to.equal(data.custom.sender);
803+
804+
cb(null, {
805+
multicast_id: "abc",
806+
success: recipients.registrationTokens.length,
807+
failure: 0,
808+
results: recipients.registrationTokens.map((token) => ({
809+
message_id: "",
810+
registration_id: token,
811+
error: null,
812+
})),
813+
});
814+
});
819815
});
820816

821817
after(() => {
822818
sendMethod.restore();
823819
});
824820

825-
it('should merge fcm_notification overrides with base notification', (done) => {
821+
it("should merge fcm_notification overrides with base notification", (done) => {
826822
const androidData = {
827823
...data,
828824
fcm_notification: {
829-
color: '#FF0000', // Override only the color
825+
color: "#FF0000", // Override only the color
830826
},
831827
};
832-
pn.send(regIds, androidData, (err, results) =>
833-
testSuccess(err, results, done)
834-
);
828+
pn.send(regIds, androidData, (err, results) => testSuccess(err, results, done));
835829
});
836830
});
837831

838-
describe('send push notifications in phonegap-push compatibility mode', () => {
832+
describe("send push notifications in phonegap-push compatibility mode", () => {
839833
const pushPhoneGap = new PN({
840834
gcm: {
841835
phonegap: true,

0 commit comments

Comments
 (0)