@@ -102,15 +102,17 @@ var validMessages = []struct {
102
102
name : "NotificationMessage" ,
103
103
req : & Message {
104
104
Notification : & Notification {
105
- Title : "t" ,
106
- Body : "b" ,
105
+ Title : "t" ,
106
+ Body : "b" ,
107
+ ImageURL : "http://image.jpg" ,
107
108
},
108
109
Topic : "test-topic" ,
109
110
},
110
111
want : map [string ]interface {}{
111
112
"notification" : map [string ]interface {}{
112
113
"title" : "t" ,
113
114
"body" : "b" ,
115
+ "image" : "http://image.jpg" ,
114
116
},
115
117
"topic" : "test-topic" ,
116
118
},
@@ -157,6 +159,7 @@ var validMessages = []struct {
157
159
BodyLocKey : "blk" ,
158
160
BodyLocArgs : []string {"b1" , "b2" },
159
161
ChannelID : "channel" ,
162
+ ImageURL : "http://image.jpg" ,
160
163
},
161
164
TTL : & ttlWithNanos ,
162
165
FCMOptions : & AndroidFCMOptions {
@@ -178,6 +181,7 @@ var validMessages = []struct {
178
181
"body_loc_key" : "blk" ,
179
182
"body_loc_args" : []interface {}{"b1" , "b2" },
180
183
"channel_id" : "channel" ,
184
+ "image" : "http://image.jpg" ,
181
185
},
182
186
"ttl" : "1.500000000s" ,
183
187
"fcm_options" : map [string ]interface {}{
@@ -322,6 +326,7 @@ var validMessages = []struct {
322
326
},
323
327
FCMOptions : & APNSFCMOptions {
324
328
AnalyticsLabel : "Analytics" ,
329
+ ImageURL : "http://image.jpg" ,
325
330
},
326
331
},
327
332
Topic : "test-topic" ,
@@ -344,6 +349,7 @@ var validMessages = []struct {
344
349
},
345
350
"fcm_options" : map [string ]interface {}{
346
351
"analytics_label" : "Analytics" ,
352
+ "image" : "http://image.jpg" ,
347
353
},
348
354
},
349
355
"topic" : "test-topic" ,
@@ -525,6 +531,16 @@ var invalidMessages = []struct {
525
531
},
526
532
want : "malformed topic name" ,
527
533
},
534
+ {
535
+ name : "InvalidNotificationImage" ,
536
+ req : & Message {
537
+ Notification : & Notification {
538
+ ImageURL : "image.jpg" ,
539
+ },
540
+ Topic : "topic" ,
541
+ },
542
+ want : `invalid image URL: "image.jpg"` ,
543
+ },
528
544
{
529
545
name : "InvalidAndroidTTL" ,
530
546
req : & Message {
@@ -593,6 +609,18 @@ var invalidMessages = []struct {
593
609
},
594
610
want : "bodyLocKey is required when specifying bodyLocArgs" ,
595
611
},
612
+ {
613
+ name : "InvalidAndroidImage" ,
614
+ req : & Message {
615
+ Android : & AndroidConfig {
616
+ Notification : & AndroidNotification {
617
+ ImageURL : "image.jpg" ,
618
+ },
619
+ },
620
+ Topic : "topic" ,
621
+ },
622
+ want : `invalid image URL: "image.jpg"` ,
623
+ },
596
624
{
597
625
name : "APNSMultipleAps" ,
598
626
req : & Message {
@@ -688,6 +716,18 @@ var invalidMessages = []struct {
688
716
},
689
717
want : "locKey is required when specifying locArgs" ,
690
718
},
719
+ {
720
+ name : "InvalidAPNSImage" ,
721
+ req : & Message {
722
+ APNS : & APNSConfig {
723
+ FCMOptions : & APNSFCMOptions {
724
+ ImageURL : "image.jpg" ,
725
+ },
726
+ },
727
+ Topic : "topic" ,
728
+ },
729
+ want : `invalid image URL: "image.jpg"` ,
730
+ },
691
731
{
692
732
name : "MultipleSoundSpecifications" ,
693
733
req : & Message {
0 commit comments