Skip to content

Commit 1a9cd96

Browse files
committed
Remove done()
1 parent a2560bc commit 1a9cd96

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

spec/FCM.spec.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const FCM = require('../src/FCM').default;
22
const path = require('path');
33

44
describe('FCM', () => {
5-
it('can initialize', (done) => {
5+
it('can initialize', () => {
66
const args = {
77
firebaseServiceAccount: path.join(
88
__dirname,
@@ -14,10 +14,9 @@ describe('FCM', () => {
1414
};
1515
const fcm = new FCM(args);
1616
expect(fcm).toBeDefined();
17-
done();
1817
});
1918

20-
it('can use a raw FCM payload', (done) => {
19+
it('can use a raw FCM payload', () => {
2120
// If the payload is wrapped inside a key named 'rawPayload', a user can use the raw FCM payload structure
2221
// See: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
2322
// And: https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.multicastmessage.md#multicastmessage_interface
@@ -68,10 +67,9 @@ describe('FCM', () => {
6867
expect(payload.data.tokens).toEqual(['testToken']);
6968
expect(payload.time).toEqual(timeStampISOStr);
7069
expect(payload['push_id']).toEqual(pushId);
71-
done();
7270
});
7371

74-
it('can slice devices', (done) => {
72+
it('can slice devices', () => {
7573
// Mock devices
7674
var devices = [makeDevice(1), makeDevice(2), makeDevice(3), makeDevice(4)];
7775

@@ -80,11 +78,10 @@ describe('FCM', () => {
8078
[makeDevice(1), makeDevice(2), makeDevice(3)],
8179
[makeDevice(4)],
8280
]);
83-
done();
8481
});
8582

8683
describe('GCM payloads can be converted to compatible FCMv1 payloads', () => {
87-
it('can generate GCM Payload without expiration time', (done) => {
84+
it('can generate GCM Payload without expiration time', () => {
8885
// To maintain backwards compatibility with GCM payload format
8986
// See corresponding test with same test label in GCM.spec.js
9087

@@ -122,10 +119,9 @@ describe('FCM', () => {
122119

123120
const dataFromUser = fcmPayload.android.data;
124121
expect(dataFromUser).toEqual(requestData.data);
125-
done();
126122
});
127123

128-
it('can generate GCM Payload with valid expiration time', (done) => {
124+
it('can generate GCM Payload with valid expiration time', () => {
129125
// To maintain backwards compatibility with GCM payload format
130126
// See corresponding test with same test label in GCM.spec.js
131127

@@ -172,10 +168,9 @@ describe('FCM', () => {
172168

173169
const dataFromUser = fcmPayload.android.data;
174170
expect(dataFromUser).toEqual(requestData.data);
175-
done();
176171
});
177172

178-
it('can generate GCM Payload with too early expiration time', (done) => {
173+
it('can generate GCM Payload with too early expiration time', () => {
179174
// To maintain backwards compatibility with GCM payload format
180175
// See corresponding test with same test label in GCM.spec.js
181176

@@ -213,10 +208,9 @@ describe('FCM', () => {
213208

214209
const dataFromUser = fcmPayload.android.data;
215210
expect(dataFromUser).toEqual(requestData.data);
216-
done();
217211
});
218212

219-
it('can generate GCM Payload with too late expiration time', (done) => {
213+
it('can generate GCM Payload with too late expiration time', () => {
220214
const expirationTime = 2454538822113;
221215

222216
const requestData = {
@@ -255,7 +249,6 @@ describe('FCM', () => {
255249

256250
const dataFromUser = fcmPayload.android.data;
257251
expect(dataFromUser).toEqual(requestData.data);
258-
done();
259252
});
260253
});
261254

@@ -265,7 +258,7 @@ describe('FCM', () => {
265258
// We also do not need to pass APNS headers like expiration_time, collapse_id etc to FCM.generatePayload() as is done for APNS._generateNotification() for generating the payload.
266259
// APNS headers get set if present in the payload data.
267260
describe('APNS payloads can be converted to compatible FCMv1 payloads', () => {
268-
it('can generate APNS notification', (done) => {
261+
it('can generate APNS notification', () => {
269262
// To maintain backwards compatibility with APNS payload format
270263
// See corresponding test with same test label in APNS.spec.js
271264

@@ -339,10 +332,9 @@ describe('FCM', () => {
339332

340333
expect(payload.time).toEqual(timeStampISOStr);
341334
expect(payload['push_id']).toEqual(pushId);
342-
done();
343335
});
344336

345-
it('sets push type to alert if not defined explicitly', (done) => {
337+
it('sets push type to alert if not defined explicitly', () => {
346338
let data = {
347339
alert: 'alert',
348340
title: 'title',
@@ -372,10 +364,9 @@ describe('FCM', () => {
372364
expect(fcmPayload.apns.headers['apns-push-type']).toEqual('alert');
373365
expect(payload.time).toEqual(timeStampISOStr);
374366
expect(payload['push_id']).toEqual(pushId);
375-
done();
376367
});
377368

378-
it('can generate APNS notification from raw data', (done) => {
369+
it('can generate APNS notification from raw data', () => {
379370
let expirationTime = 1454571491354;
380371
let collapseId = 'collapseIdentifier';
381372
let pushType = 'background';
@@ -429,10 +420,9 @@ describe('FCM', () => {
429420

430421
expect(payload.time).toEqual(timeStampISOStr);
431422
expect(payload['push_id']).toEqual(pushId);
432-
done();
433423
});
434424

435-
it('can generate an APNS notification with headers in data', (done) => {
425+
it('can generate an APNS notification with headers in data', () => {
436426
// See 'can send APNS notification headers in data' in APNS.spec.js
437427
// Not mocking sends currently, only payload generation
438428

@@ -474,7 +464,6 @@ describe('FCM', () => {
474464

475465
expect(payload.time).toEqual(timeStampISOStr);
476466
expect(payload['push_id']).toEqual(pushId);
477-
done();
478467
});
479468
});
480469

0 commit comments

Comments
 (0)