@@ -873,16 +873,22 @@ describe('Messaging', () => {
873873 'projects/projec_id/messages/3' ,
874874 ] ;
875875 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 ;
885890 } ) ;
891+ } ) ;
886892 } ) ;
887893
888894 it ( 'should be fulfilled with a BatchResponse given valid message in dryRun mode' , ( ) => {
@@ -892,15 +898,21 @@ describe('Messaging', () => {
892898 'projects/projec_id/messages/3' ,
893899 ] ;
894900 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 ] ) ;
903914 } ) ;
915+ } ) ;
904916 } ) ;
905917
906918 it ( 'should be fulfilled with a BatchResponse when the response contains some errors' , ( ) => {
0 commit comments