@@ -156,13 +156,64 @@ - (void)testModifyNotificationWithInvalidPayloadDataValidMimeType {
156156 }
157157}
158158
159- - (void )testDeliveryMetricsLogging {
159+ - (void )testDeliveryMetricsLoggingWithEmptyPayload {
160160 OCMStub ([_mockUtilClass isAppExtension ]).andReturn (YES );
161161 NSDictionary *fakeMessageInfo = @{@" aps" : @{}};
162162
163163 [_mockExtensionHelper exportDeliveryMetricsToBigQueryWithMessageInfo: fakeMessageInfo];
164- OCMVerify ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
164+ OCMReject ([_mockExtensionHelper bundleIdentifierByRemovingLastPartFrom: [OCMArg any ]]);
165165}
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+
166217@end
167218
168219#endif // TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_WATCH
0 commit comments