@@ -156,13 +156,64 @@ - (void)testModifyNotificationWithInvalidPayloadDataValidMimeType {
156
156
}
157
157
}
158
158
159
- - (void )testDeliveryMetricsLogging {
159
+ - (void )testDeliveryMetricsLoggingWithEmptyPayload {
160
160
OCMStub ([_mockUtilClass isAppExtension ]).andReturn (YES );
161
161
NSDictionary *fakeMessageInfo = @{@" aps" : @{}};
162
162
163
163
[_mockExtensionHelper exportDeliveryMetricsToBigQueryWithMessageInfo: fakeMessageInfo];
164
- OCMVerify ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
164
+ OCMReject ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
165
165
}
166
+
167
+ - (void )testDeliveryMetricsLoggingWithInvalidMessageID {
168
+ OCMStub ([_mockUtilClass isAppExtension ]).andReturn (YES );
169
+ NSDictionary *fakeMessageInfo = @{
170
+ @" aps" : @{@" badge" : @9 , @" mutable-content" : @1 },
171
+ @" fcm_options" : @{@" image" : @" https://google.com" },
172
+ @" google.c.fid" : @" fakeFIDForTest" ,
173
+ @" google.c.sender.id" : @123456789
174
+ };
175
+ [_mockExtensionHelper exportDeliveryMetricsToBigQueryWithMessageInfo: fakeMessageInfo];
176
+ OCMReject ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
177
+ }
178
+
179
+ - (void )testDeliveryMetricsLoggingWithInvalidFID {
180
+ OCMStub ([_mockUtilClass isAppExtension ]).andReturn (YES );
181
+ NSDictionary *fakeMessageInfo = @{
182
+ @" aps" : @{@" badge" : @9 , @" mutable-content" : @1 },
183
+ @" fcm_options" : @{@" image" : @" https://google.com" },
184
+ @" google.c.sender.id" : @123456789
185
+ };
186
+ [_mockExtensionHelper exportDeliveryMetricsToBigQueryWithMessageInfo: fakeMessageInfo];
187
+ OCMReject ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
188
+ }
189
+
190
+ - (void )testDeliveryMetricsLoggingWithDisplayPayload {
191
+ OCMStub ([_mockUtilClass isAppExtension ]).andReturn (YES );
192
+ NSDictionary *fakeMessageInfo = @{
193
+ @" aps" : @{@" badge" : @9 , @" mutable-content" : @1 },
194
+ @" fcm_options" : @{@" image" : @" https://google.com" },
195
+ @" gcm.message_id" : @" 1627428480762269" ,
196
+ @" google.c.fid" : @" fakeFIDForTest" ,
197
+ @" google.c.sender.id" : @123456789
198
+ };
199
+
200
+ [_mockExtensionHelper exportDeliveryMetricsToBigQueryWithMessageInfo: fakeMessageInfo];
201
+ OCMExpect ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
202
+ }
203
+
204
+ - (void )testDeliveryMetricsLoggingWithDataPayload {
205
+ OCMStub ([_mockUtilClass isAppExtension ]).andReturn (NO );
206
+ NSDictionary *fakeMessageInfo = @{
207
+ @" aps" : @{@" badge" : @9 , @" content-available" : @1 },
208
+ @" fcm_options" : @{@" image" : @" https://google.com" },
209
+ @" gcm.message_id" : @" 1627428480762269" ,
210
+ @" google.c.fid" : @" fakeFIDForTest" ,
211
+ @" google.c.sender.id" : @123456789
212
+ };
213
+ [_mockExtensionHelper exportDeliveryMetricsToBigQueryWithMessageInfo: fakeMessageInfo];
214
+ OCMReject ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
215
+ }
216
+
166
217
@end
167
218
168
219
#endif // TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_WATCH
0 commit comments