@@ -102,15 +102,17 @@ var validMessages = []struct {
102102name : "NotificationMessage" ,
103103req : & Message {
104104Notification : & Notification {
105- Title : "t" ,
106- Body : "b" ,
105+ Title : "t" ,
106+ Body : "b" ,
107+ ImageURL : "http://image.jpg" ,
107108},
108109Topic : "test-topic" ,
109110},
110111want : map [string ]interface {}{
111112"notification" : map [string ]interface {}{
112113"title" : "t" ,
113114"body" : "b" ,
115+ "image" : "http://image.jpg" ,
114116},
115117"topic" : "test-topic" ,
116118},
@@ -157,6 +159,7 @@ var validMessages = []struct {
157159BodyLocKey : "blk" ,
158160BodyLocArgs : []string {"b1" , "b2" },
159161ChannelID : "channel" ,
162+ ImageURL : "http://image.jpg" ,
160163},
161164TTL : & ttlWithNanos ,
162165FCMOptions : & AndroidFCMOptions {
@@ -178,6 +181,7 @@ var validMessages = []struct {
178181"body_loc_key" : "blk" ,
179182"body_loc_args" : []interface {}{"b1" , "b2" },
180183"channel_id" : "channel" ,
184+ "image" : "http://image.jpg" ,
181185},
182186"ttl" : "1.500000000s" ,
183187"fcm_options" : map [string ]interface {}{
@@ -322,6 +326,7 @@ var validMessages = []struct {
322326},
323327FCMOptions : & APNSFCMOptions {
324328AnalyticsLabel : "Analytics" ,
329+ ImageURL : "http://image.jpg" ,
325330},
326331},
327332Topic : "test-topic" ,
@@ -344,6 +349,7 @@ var validMessages = []struct {
344349},
345350"fcm_options" : map [string ]interface {}{
346351"analytics_label" : "Analytics" ,
352+ "image" : "http://image.jpg" ,
347353},
348354},
349355"topic" : "test-topic" ,
@@ -525,6 +531,16 @@ var invalidMessages = []struct {
525531},
526532want : "malformed topic name" ,
527533},
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+ },
528544{
529545name : "InvalidAndroidTTL" ,
530546req : & Message {
@@ -593,6 +609,18 @@ var invalidMessages = []struct {
593609},
594610want : "bodyLocKey is required when specifying bodyLocArgs" ,
595611},
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+ },
596624{
597625name : "APNSMultipleAps" ,
598626req : & Message {
@@ -688,6 +716,18 @@ var invalidMessages = []struct {
688716},
689717want : "locKey is required when specifying locArgs" ,
690718},
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+ },
691731{
692732name : "MultipleSoundSpecifications" ,
693733req : & Message {
0 commit comments