@@ -873,16 +873,22 @@ describe('Messaging', () => {
873
873
'projects/projec_id/messages/3' ,
874
874
] ;
875
875
mockedRequests . push ( mockBatchRequest ( messageIds ) ) ;
876
- return messaging . sendMulticast ( { tokens : [ 'a' , 'b' , 'c' ] } )
877
- . then ( ( response : BatchResponse ) => {
878
- expect ( response . successCount ) . to . equal ( 3 ) ;
879
- expect ( response . failureCount ) . to . equal ( 0 ) ;
880
- response . responses . forEach ( ( resp , idx ) => {
881
- expect ( resp . success ) . to . be . true ;
882
- expect ( resp . messageId ) . to . equal ( messageIds [ idx ] ) ;
883
- expect ( resp . error ) . to . be . undefined ;
884
- } ) ;
876
+ return messaging . sendMulticast ( {
877
+ tokens : [ 'a' , 'b' , 'c' ] ,
878
+ android : { ttl : 100 } ,
879
+ apns : { payload : { aps : { badge : 42 } } } ,
880
+ data : { key : 'value' } ,
881
+ notification : { title : 'test title' } ,
882
+ webpush : { data : { webKey : 'webValue' } } ,
883
+ } ) . then ( ( response : BatchResponse ) => {
884
+ expect ( response . successCount ) . to . equal ( 3 ) ;
885
+ expect ( response . failureCount ) . to . equal ( 0 ) ;
886
+ response . responses . forEach ( ( resp , idx ) => {
887
+ expect ( resp . success ) . to . be . true ;
888
+ expect ( resp . messageId ) . to . equal ( messageIds [ idx ] ) ;
889
+ expect ( resp . error ) . to . be . undefined ;
885
890
} ) ;
891
+ } ) ;
886
892
} ) ;
887
893
888
894
it ( 'should be fulfilled with a BatchResponse given valid message in dryRun mode' , ( ) => {
@@ -892,15 +898,21 @@ describe('Messaging', () => {
892
898
'projects/projec_id/messages/3' ,
893
899
] ;
894
900
mockedRequests . push ( mockBatchRequest ( messageIds ) ) ;
895
- return messaging . sendMulticast ( { tokens : [ 'a' , 'b' , 'c' ] } , true )
896
- . then ( ( response : BatchResponse ) => {
897
- expect ( response . successCount ) . to . equal ( 3 ) ;
898
- expect ( response . failureCount ) . to . equal ( 0 ) ;
899
- expect ( response . responses . length ) . to . equal ( 3 ) ;
900
- response . responses . forEach ( ( resp , idx ) => {
901
- checkSendResponseSuccess ( resp , messageIds [ idx ] ) ;
902
- } ) ;
901
+ return messaging . sendMulticast ( {
902
+ tokens : [ 'a' , 'b' , 'c' ] ,
903
+ android : { ttl : 100 } ,
904
+ apns : { payload : { aps : { badge : 42 } } } ,
905
+ data : { key : 'value' } ,
906
+ notification : { title : 'test title' } ,
907
+ webpush : { data : { webKey : 'webValue' } } ,
908
+ } , true ) . then ( ( response : BatchResponse ) => {
909
+ expect ( response . successCount ) . to . equal ( 3 ) ;
910
+ expect ( response . failureCount ) . to . equal ( 0 ) ;
911
+ expect ( response . responses . length ) . to . equal ( 3 ) ;
912
+ response . responses . forEach ( ( resp , idx ) => {
913
+ checkSendResponseSuccess ( resp , messageIds [ idx ] ) ;
903
914
} ) ;
915
+ } ) ;
904
916
} ) ;
905
917
906
918
it ( 'should be fulfilled with a BatchResponse when the response contains some errors' , ( ) => {
0 commit comments