@@ -82,7 +82,7 @@ describe('Push notifications', function() {
82
82
defaultUnit : 'btc' ,
83
83
subjectPrefix : '' ,
84
84
pushServerUrl : 'http://localhost:8000' ,
85
- authorizationKey : 'secret' ,
85
+ fcmGoogleCredentialsPath : 'path_to_service_account.json'
86
86
} ,
87
87
} , function ( err ) {
88
88
should . not . exist ( err ) ;
@@ -109,15 +109,16 @@ describe('Push notifications', function() {
109
109
} , {
110
110
isGlobal : true
111
111
} , function ( err ) {
112
+ should . not . exist ( err ) ;
112
113
setTimeout ( function ( ) {
113
114
var calls = requestStub . getCalls ( ) ;
114
115
var args = _ . map ( calls , function ( c ) {
115
116
return c . args [ 0 ] ;
116
117
} ) ;
117
118
calls . length . should . equal ( 1 ) ;
118
- args [ 0 ] . body . notification . title . should . contain ( 'New payment received' ) ;
119
- args [ 0 ] . body . notification . body . should . contain ( '123,000' ) ;
120
- args [ 0 ] . body . notification . body . should . contain ( 'bits' ) ;
119
+ args [ 0 ] . body . message . notification . title . should . contain ( 'New payment received' ) ;
120
+ args [ 0 ] . body . message . notification . body . should . contain ( '123,000' ) ;
121
+ args [ 0 ] . body . message . notification . body . should . contain ( 'bits' ) ;
121
122
done ( ) ;
122
123
} , 100 ) ;
123
124
} ) ;
@@ -237,7 +238,7 @@ describe('Push notifications', function() {
237
238
defaultUnit : 'btc' ,
238
239
subjectPrefix : '' ,
239
240
pushServerUrl : 'http://localhost:8000' ,
240
- authorizationKey : 'secret' ,
241
+ fcmGoogleCredentialsPath : 'path_to_service_account.json'
241
242
} ,
242
243
} , function ( err ) {
243
244
should . not . exist ( err ) ;
@@ -273,14 +274,14 @@ describe('Push notifications', function() {
273
274
274
275
calls . length . should . equal ( 3 ) ;
275
276
276
- args [ 0 ] . body . notification . title . should . contain ( 'Nuevo pago recibido' ) ;
277
- args [ 0 ] . body . notification . body . should . contain ( '0.123' ) ;
277
+ args [ 0 ] . body . message . notification . title . should . contain ( 'Nuevo pago recibido' ) ;
278
+ args [ 0 ] . body . message . notification . body . should . contain ( '0.123' ) ;
278
279
279
- args [ 1 ] . body . notification . title . should . contain ( 'New payment received' ) ;
280
- args [ 1 ] . body . notification . body . should . contain ( '123,000' ) ;
280
+ args [ 1 ] . body . message . notification . title . should . contain ( 'New payment received' ) ;
281
+ args [ 1 ] . body . message . notification . body . should . contain ( '123,000' ) ;
281
282
282
- args [ 2 ] . body . notification . title . should . contain ( 'New payment received' ) ;
283
- args [ 2 ] . body . notification . body . should . contain ( '123,000' ) ;
283
+ args [ 2 ] . body . message . notification . title . should . contain ( 'New payment received' ) ;
284
+ args [ 2 ] . body . message . notification . body . should . contain ( '123,000' ) ;
284
285
done ( ) ;
285
286
} , 100 ) ;
286
287
} ) ;
@@ -392,7 +393,7 @@ describe('Push notifications', function() {
392
393
return c . args [ 0 ] ;
393
394
} ) ;
394
395
395
- args [ 0 ] . body . notification . title . should . contain ( 'Payment proposal rejected' ) ;
396
+ args [ 0 ] . body . message . notification . title . should . contain ( 'Payment proposal rejected' ) ;
396
397
done ( ) ;
397
398
} , 100 ) ;
398
399
} ) ;
@@ -449,11 +450,11 @@ describe('Push notifications', function() {
449
450
return c . args [ 0 ] ;
450
451
} ) ;
451
452
452
- args [ 0 ] . body . notification . title . should . contain ( 'Payment sent' ) ;
453
- args [ 1 ] . body . notification . title . should . contain ( 'Payment sent' ) ;
453
+ args [ 0 ] . body . message . notification . title . should . contain ( 'Payment sent' ) ;
454
+ args [ 1 ] . body . message . notification . title . should . contain ( 'Payment sent' ) ;
454
455
455
- sjcl . codec . hex . fromBits ( sjcl . hash . sha256 . hash ( server . copayerId ) ) . should . not . equal ( args [ 0 ] . body . data . copayerId ) ;
456
- sjcl . codec . hex . fromBits ( sjcl . hash . sha256 . hash ( server . copayerId ) ) . should . not . equal ( args [ 1 ] . body . data . copayerId ) ;
456
+ sjcl . codec . hex . fromBits ( sjcl . hash . sha256 . hash ( server . copayerId ) ) . should . not . equal ( args [ 0 ] . body . message . data . copayerId ) ;
457
+ sjcl . codec . hex . fromBits ( sjcl . hash . sha256 . hash ( server . copayerId ) ) . should . not . equal ( args [ 1 ] . body . message . data . copayerId ) ;
457
458
done ( ) ;
458
459
} , 100 ) ;
459
460
} ) ;
@@ -490,7 +491,7 @@ describe('Push notifications', function() {
490
491
defaultUnit : 'btc' ,
491
492
subjectPrefix : '' ,
492
493
pushServerUrl : 'http://localhost:8000' ,
493
- authorizationKey : 'secret' ,
494
+ fcmGoogleCredentialsPath : 'path_to_service_account.json'
494
495
} ,
495
496
} , function ( err ) {
496
497
should . not . exist ( err ) ;
@@ -528,7 +529,7 @@ describe('Push notifications', function() {
528
529
var args = _ . filter ( _ . map ( calls , function ( call ) {
529
530
return call . args [ 0 ] ;
530
531
} ) , function ( arg ) {
531
- return arg . body . notification . title == 'New copayer' ;
532
+ return arg . body . message . notification . title == 'New copayer' ;
532
533
} ) ;
533
534
534
535
server . getWallet ( null , function ( err , wallet ) {
@@ -540,24 +541,24 @@ describe('Push notifications', function() {
540
541
var hashedCopayerIds = _ . map ( wallet . copayers , function ( copayer ) {
541
542
return sjcl . codec . hex . fromBits ( sjcl . hash . sha256 . hash ( copayer . id ) ) ;
542
543
} ) ;
543
- hashedCopayerIds [ 0 ] . should . equal ( ( args [ 0 ] . body . data . copayerId ) ) ;
544
- hashedCopayerIds [ 1 ] . should . not . equal ( ( args [ 0 ] . body . data . copayerId ) ) ;
544
+ hashedCopayerIds [ 0 ] . should . equal ( ( args [ 0 ] . body . message . data . copayerId ) ) ;
545
+ hashedCopayerIds [ 1 ] . should . not . equal ( ( args [ 0 ] . body . message . data . copayerId ) ) ;
545
546
546
547
/*
547
548
Second call - copayer3 joined
548
549
copayer3 should notify to copayer1
549
550
*/
550
- hashedCopayerIds [ 0 ] . should . equal ( ( args [ 1 ] . body . data . copayerId ) ) ;
551
+ hashedCopayerIds [ 0 ] . should . equal ( ( args [ 1 ] . body . message . data . copayerId ) ) ;
551
552
552
553
/*
553
554
Third call - copayer3 joined
554
555
copayer3 should notify to copayer2
555
556
*/
556
- hashedCopayerIds [ 1 ] . should . equal ( ( args [ 2 ] . body . data . copayerId ) ) ;
557
+ hashedCopayerIds [ 1 ] . should . equal ( ( args [ 2 ] . body . message . data . copayerId ) ) ;
557
558
558
559
// copayer3 should NOT notify any other copayer
559
- hashedCopayerIds [ 2 ] . should . not . equal ( ( args [ 1 ] . body . data . copayerId ) ) ;
560
- hashedCopayerIds [ 2 ] . should . not . equal ( ( args [ 2 ] . body . data . copayerId ) ) ;
560
+ hashedCopayerIds [ 2 ] . should . not . equal ( ( args [ 1 ] . body . message . data . copayerId ) ) ;
561
+ hashedCopayerIds [ 2 ] . should . not . equal ( ( args [ 2 ] . body . message . data . copayerId ) ) ;
561
562
done ( ) ;
562
563
} ) ;
563
564
} , 100 ) ;
@@ -614,7 +615,7 @@ describe('Push notifications', function() {
614
615
defaultUnit : 'eth' ,
615
616
subjectPrefix : '' ,
616
617
pushServerUrl : 'http://localhost:8000' ,
617
- authorizationKey : 'secret' ,
618
+ fcmGoogleCredentialsPath : 'path_to_service_account.json'
618
619
} ,
619
620
} , function ( err ) {
620
621
should . not . exist ( err ) ;
@@ -648,10 +649,10 @@ describe('Push notifications', function() {
648
649
var args = _ . map ( _ . takeRight ( calls , 2 ) , function ( c ) {
649
650
return c . args [ 0 ] ;
650
651
} ) ;
651
- args [ 0 ] . body . notification . title . should . contain ( 'New payment received' ) ;
652
- args [ 0 ] . body . notification . title . should . contain ( 'New payment received' ) ;
653
- args [ 0 ] . body . notification . body . should . contain ( '4.00' ) ;
654
- args [ 0 ] . body . data . tokenAddress . should . equal ( '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ) ;
652
+ args [ 0 ] . body . message . notification . title . should . contain ( 'New payment received' ) ;
653
+ args [ 0 ] . body . message . notification . title . should . contain ( 'New payment received' ) ;
654
+ args [ 0 ] . body . message . notification . body . should . contain ( '4.00' ) ;
655
+ args [ 0 ] . body . message . data . tokenAddress . should . equal ( '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ) ;
655
656
done ( ) ;
656
657
} , 100 ) ;
657
658
} ) ;
@@ -681,9 +682,9 @@ describe('Push notifications', function() {
681
682
var args = _ . map ( _ . takeRight ( calls , 2 ) , function ( c ) {
682
683
return c . args [ 0 ] ;
683
684
} ) ;
684
- args [ 0 ] . body . notification . title . should . contain ( 'Nuevo pago recibido' ) ;
685
- args [ 0 ] . body . notification . body . should . contain ( '4.00' ) ;
686
- args [ 0 ] . body . data . tokenAddress . should . equal ( '0x8E870D67F660D95d5be530380D0eC0bd388289E1' ) ;
685
+ args [ 0 ] . body . message . notification . title . should . contain ( 'Nuevo pago recibido' ) ;
686
+ args [ 0 ] . body . message . notification . body . should . contain ( '4.00' ) ;
687
+ args [ 0 ] . body . message . data . tokenAddress . should . equal ( '0x8E870D67F660D95d5be530380D0eC0bd388289E1' ) ;
687
688
done ( ) ;
688
689
} , 100 ) ;
689
690
} ) ;
@@ -713,9 +714,9 @@ describe('Push notifications', function() {
713
714
var args = _ . map ( _ . takeRight ( calls , 2 ) , function ( c ) {
714
715
return c . args [ 0 ] ;
715
716
} ) ;
716
- args [ 0 ] . body . notification . title . should . contain ( 'New payment received' ) ;
717
- args [ 0 ] . body . notification . body . should . contain ( '4.00' ) ;
718
- args [ 0 ] . body . data . tokenAddress . should . equal ( '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd' ) ;
717
+ args [ 0 ] . body . message . notification . title . should . contain ( 'New payment received' ) ;
718
+ args [ 0 ] . body . message . notification . body . should . contain ( '4.00' ) ;
719
+ args [ 0 ] . body . message . data . tokenAddress . should . equal ( '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd' ) ;
719
720
done ( ) ;
720
721
} , 100 ) ;
721
722
} ) ;
0 commit comments