@@ -183,6 +183,9 @@ final class BlazeLocalNotificationSchedulerTests: XCTestCase {
183
183
184
184
let scenario = pushNotesManager. requestedLocalNotifications. first? . scenario
185
185
XCTAssertEqual ( scenario, LocalNotification . Scenario. blazeNoCampaignReminder)
186
+ let userInfo = try XCTUnwrap ( pushNotesManager. requestedLocalNotifications. first? . userInfo)
187
+ let siteIDFromNotification = try XCTUnwrap ( userInfo [ " site_id " ] as? Int64 )
188
+ XCTAssertEqual ( siteID, siteIDFromNotification)
186
189
}
187
190
188
191
func test_notification_is_not_scheduled_when_only_evergreen_campaign_exists_in_storage( ) async throws {
@@ -299,6 +302,36 @@ final class BlazeLocalNotificationSchedulerTests: XCTestCase {
299
302
// Then
300
303
XCTAssertTrue ( pushNotesManager. canceledLocalNotificationScenarios. contains ( [ LocalNotification . Scenario. blazeNoCampaignReminder] ) )
301
304
}
305
+
306
+ func test_notification_has_siteID_in_user_info( ) async throws {
307
+ // Given
308
+ let blazeEligibilityChecker = MockBlazeEligibilityChecker ( isSiteEligible: true )
309
+ let campaignStartDate = Date . now. addingDays ( 1 )
310
+ let fakeBlazeCampaign = BlazeCampaignListItem . fake ( ) . copy ( siteID: siteID,
311
+ budgetCurrency: " USD " ,
312
+ isEvergreen: false ,
313
+ durationDays: 15 ,
314
+ startTime: campaignStartDate)
315
+ let sut = DefaultBlazeLocalNotificationScheduler ( siteID: siteID,
316
+ stores: stores,
317
+ storageManager: storageManager,
318
+ userDefaults: defaults,
319
+ pushNotesManager: pushNotesManager,
320
+ blazeEligibilityChecker: blazeEligibilityChecker)
321
+ await sut. scheduleNotifications ( )
322
+
323
+ // When
324
+ insertCampaigns ( [ fakeBlazeCampaign] )
325
+
326
+ // Then
327
+ waitUntil {
328
+ self . pushNotesManager. requestedLocalNotifications. isNotEmpty
329
+ }
330
+
331
+ let userInfo = try XCTUnwrap ( pushNotesManager. requestedLocalNotifications. first? . userInfo)
332
+ let siteIDFromNotification = try XCTUnwrap ( userInfo [ " site_id " ] as? Int64 )
333
+ XCTAssertEqual ( siteID, siteIDFromNotification)
334
+ }
302
335
}
303
336
304
337
private extension BlazeLocalNotificationSchedulerTests {
0 commit comments