Skip to content

Commit 69840c6

Browse files
authored
feat: Remove Google Cloud Messaging (GCM) API (#450)
BREAKING CHANGE: This removes the already out-of-service Google Cloud Messaging (GCM) API.
1 parent 34cc574 commit 69840c6

File tree

8 files changed

+469
-1207
lines changed

8 files changed

+469
-1207
lines changed

package-lock.json

Lines changed: 397 additions & 640 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"license": "MIT",
2626
"dependencies": {
2727
"@parse/node-apn": "6.5.0",
28-
"@parse/node-gcm": "1.0.2",
2928
"expo-server-sdk": "3.15.0",
3029
"firebase-admin": "13.5.0",
3130
"npmlog": "7.0.1",

spec/FCM.spec.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ describe('FCM', () => {
2727
});
2828

2929
it('can throw on initializing with invalid args', () => {
30-
expect(function() { new FCM(123); }).toThrow();
31-
expect(function() { new FCM({}); }).toThrow();
30+
expect(function () { new FCM(123); }).toThrow();
31+
expect(function () { new FCM({}); }).toThrow();
3232
});
3333

3434
it('does log on invalid payload', async () => {
@@ -71,8 +71,8 @@ describe('FCM', () => {
7171
});
7272

7373
it('can send successful FCM android request', async () => {
74-
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => {});
75-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
74+
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => { });
75+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
7676
const fcm = new FCM(testArgs);
7777
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
7878
return Promise.resolve({
@@ -98,8 +98,8 @@ describe('FCM', () => {
9898
});
9999

100100
it('can send successful FCM android request with apns integer keys', async () => {
101-
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => {});
102-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
101+
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => { });
102+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
103103
const fcm = new FCM(testArgs);
104104
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
105105
return Promise.resolve({
@@ -126,8 +126,8 @@ describe('FCM', () => {
126126
});
127127

128128
it('can send successful FCM apple request with alert', async () => {
129-
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => {});
130-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
129+
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => { });
130+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
131131
const fcm = new FCM(testArgs);
132132
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
133133
return Promise.resolve({
@@ -153,8 +153,8 @@ describe('FCM', () => {
153153
});
154154

155155
it('can send successful FCM apple request with title', async () => {
156-
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => {});
157-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
156+
const spyVerbose = spyOn(log, 'verbose').and.callFake(() => { });
157+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
158158
const fcm = new FCM(testArgs);
159159
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
160160
return Promise.resolve({
@@ -180,8 +180,8 @@ describe('FCM', () => {
180180
});
181181

182182
it('can send failed FCM request', async () => {
183-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
184-
const spyError = spyOn(log, 'error').and.callFake(() => {});
183+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
184+
const spyError = spyOn(log, 'error').and.callFake(() => { });
185185
const fcm = new FCM(testArgs);
186186
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
187187
return Promise.resolve({
@@ -203,14 +203,14 @@ describe('FCM', () => {
203203
expect(spyError.calls.all()[1].args).toEqual(['parse-server-push-adapter FCM', 'tokens with failed pushes: ["token"]']);
204204
expect(response).toEqual([[{
205205
device: { deviceToken: 'token', deviceType: 'apple' },
206-
response: { error: 'testing failed'},
206+
response: { error: 'testing failed' },
207207
transmitted: false,
208208
}]]);
209209
});
210210

211211
it('can handle FCM request error', async () => {
212-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
213-
const spyError = spyOn(log, 'error').and.callFake(() => {});
212+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
213+
const spyError = spyOn(log, 'error').and.callFake(() => { });
214214
const fcm = new FCM(testArgs);
215215
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
216216
return Promise.reject('testing error abort');
@@ -225,8 +225,8 @@ describe('FCM', () => {
225225
});
226226

227227
it('rejects exceptions that are unhandled by FCM client', async () => {
228-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
229-
const spyError = spyOn(log, 'error').and.callFake(() => {});
228+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
229+
const spyError = spyOn(log, 'error').and.callFake(() => { });
230230
testArgs.resolveUnhandledClientError = false;
231231
const fcm = new FCM(testArgs);
232232
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
@@ -235,6 +235,7 @@ describe('FCM', () => {
235235
fcm.pushType = 'android';
236236
const data = { data: { alert: 'alert' } };
237237
const devices = [{ deviceToken: 'token' }];
238+
// eslint-disable-next-line no-undef
238239
await expectAsync(fcm.send(data, devices)).toBeRejectedWith(new Parse.Error(Parse.Error.OTHER_CAUSE, 'Error: test error'));
239240
expect(fcm.sender.sendEachForMulticast).toHaveBeenCalled();
240241
expect(spyInfo).toHaveBeenCalledWith('parse-server-push-adapter FCM', 'sending push to 1 devices');
@@ -244,8 +245,8 @@ describe('FCM', () => {
244245
});
245246

246247
it('resolves exceptions that are unhandled by FCM client', async () => {
247-
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
248-
const spyError = spyOn(log, 'error').and.callFake(() => {});
248+
const spyInfo = spyOn(log, 'info').and.callFake(() => { });
249+
const spyError = spyOn(log, 'error').and.callFake(() => { });
249250
testArgs.resolveUnhandledClientError = true;
250251
const fcm = new FCM(testArgs);
251252
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
@@ -254,6 +255,7 @@ describe('FCM', () => {
254255
fcm.pushType = 'android';
255256
const data = { data: { alert: 'alert' } };
256257
const devices = [{ deviceToken: 'token' }];
258+
// eslint-disable-next-line no-undef
257259
await expectAsync(fcm.send(data, devices)).toBeResolved();
258260
expect(fcm.sender.sendEachForMulticast).toHaveBeenCalled();
259261
expect(spyInfo).toHaveBeenCalledWith('parse-server-push-adapter FCM', 'sending push to 1 devices');

0 commit comments

Comments
 (0)