@@ -169,8 +169,9 @@ describe('APNS', () => {
169
169
'keyAgain' : 'valueAgain'
170
170
} ;
171
171
let expirationTime = 1454571491354 ;
172
+ let collapseId = "collapseIdentifier" ;
172
173
173
- let notification = APNS . _generateNotification ( data , expirationTime ) ;
174
+ let notification = APNS . _generateNotification ( data , { expirationTime : expirationTime , collapseId : collapseId } ) ;
174
175
175
176
expect ( notification . aps . alert ) . toEqual ( data . alert ) ;
176
177
expect ( notification . aps . badge ) . toEqual ( data . badge ) ;
@@ -183,6 +184,7 @@ describe('APNS', () => {
183
184
'keyAgain' : 'valueAgain'
184
185
} ) ;
185
186
expect ( notification . expiry ) . toEqual ( expirationTime / 1000 ) ;
187
+ expect ( notification . collapseId ) . toEqual ( collapseId ) ;
186
188
done ( ) ;
187
189
} ) ;
188
190
@@ -239,7 +241,9 @@ describe('APNS', () => {
239
241
} ) ;
240
242
// Mock data
241
243
let expirationTime = 1454571491354 ;
244
+ let collapseId = "collapseIdentifier" ;
242
245
let data = {
246
+ 'collapse_id' : collapseId ,
243
247
'expiration_time' : expirationTime ,
244
248
'data' : {
245
249
'alert' : 'alert'
@@ -270,6 +274,7 @@ describe('APNS', () => {
270
274
let notification = calledArgs [ 0 ] ;
271
275
expect ( notification . aps . alert ) . toEqual ( data . data . alert ) ;
272
276
expect ( notification . expiry ) . toEqual ( data [ 'expiration_time' ] / 1000 ) ;
277
+ expect ( notification . collapseId ) . toEqual ( data [ 'collapse_id' ] ) ;
273
278
let apnDevices = calledArgs [ 1 ] ;
274
279
expect ( apnDevices . length ) . toEqual ( 4 ) ;
275
280
done ( ) ;
@@ -306,7 +311,9 @@ describe('APNS', () => {
306
311
apns . providers = [ provider , providerDev ] ;
307
312
// Mock data
308
313
let expirationTime = 1454571491354 ;
314
+ let collapseId = "collapseIdentifier" ;
309
315
let data = {
316
+ 'collapse_id' : collapseId ,
310
317
'expiration_time' : expirationTime ,
311
318
'data' : {
312
319
'alert' : 'alert'
@@ -343,6 +350,7 @@ describe('APNS', () => {
343
350
let notification = calledArgs [ 0 ] ;
344
351
expect ( notification . aps . alert ) . toEqual ( data . data . alert ) ;
345
352
expect ( notification . expiry ) . toEqual ( data [ 'expiration_time' ] / 1000 ) ;
353
+ expect ( notification . collapseId ) . toEqual ( data [ 'collapse_id' ] ) ;
346
354
let apnDevices = calledArgs [ 1 ] ;
347
355
expect ( apnDevices . length ) . toBe ( 3 ) ;
348
356
@@ -351,6 +359,7 @@ describe('APNS', () => {
351
359
notification = calledArgs [ 0 ] ;
352
360
expect ( notification . aps . alert ) . toEqual ( data . data . alert ) ;
353
361
expect ( notification . expiry ) . toEqual ( data [ 'expiration_time' ] / 1000 ) ;
362
+ expect ( notification . collapseId ) . toEqual ( data [ 'collapse_id' ] ) ;
354
363
apnDevices = calledArgs [ 1 ] ;
355
364
expect ( apnDevices . length ) . toBe ( 2 ) ;
356
365
done ( ) ;
0 commit comments