@@ -438,7 +438,9 @@ - (void)testSubscriptionChangeObserverFireAfterAppRestart {
438438 [UnitTestCommonMethods initOneSignal_andThreadWait ];
439439 OSSubscriptionStateTestObserver* observer = [OSSubscriptionStateTestObserver new ];
440440 [OneSignal addSubscriptionObserver: observer];
441-
441+ [UnitTestCommonMethods runBackgroundThreads ];
442+ XCTAssertEqual (observer->last .to .isSubscribed , true );
443+
442444 // User kills app, turns off notifications, then opnes it agian.
443445 [UnitTestCommonMethods clearStateForAppRestart: self ];
444446 [UnitTestCommonMethods setCurrentNotificationPermission: false ];
@@ -449,7 +451,7 @@ - (void)testSubscriptionChangeObserverFireAfterAppRestart {
449451 [OneSignal addSubscriptionObserver: observer];
450452 [UnitTestCommonMethods runBackgroundThreads ];
451453
452- XCTAssertEqual (observer-> last . from . isSubscribed , true );
454+
453455 XCTAssertEqual (observer->last .to .isSubscribed , false );
454456}
455457
@@ -574,7 +576,8 @@ - (void)testPermissionAndSubscriptionChangeObserverRemove {
574576 [UnitTestCommonMethods runBackgroundThreads ];
575577
576578 XCTAssertNil (permissionObserver->last );
577- XCTAssertNil (subscriptionObserver->last );
579+ XCTAssertTrue ([[OneSignal getDeviceState ] isSubscribed ]);
580+ XCTAssertFalse (subscriptionObserver->last .to .isSubscribed );
578581}
579582
580583- (void )testSubscriptionChangeObserverBasic {
@@ -1815,11 +1818,11 @@ - (void)testPushNotificationToken {
18151818 XCTAssertNil (observer->last .to .userId );
18161819 XCTAssertFalse (observer->last .to .isSubscribed );
18171820
1818- [OneSignal disablePush: false ];
1821+ [OneSignal disablePush: true ]; // This should not result in a a change in state because we are waiting on privacy
18191822 [UnitTestCommonMethods runBackgroundThreads ];
18201823
1821- XCTAssertFalse (observer->last .from .isPushDisabled );
1822- XCTAssertFalse (observer->last .to .isPushDisabled );
1824+ XCTAssertTrue (observer->last .from .isPushDisabled ); // Initial from is that push is disabled
1825+ XCTAssertFalse (observer->last .to .isPushDisabled ); // Default value after adding an observer is that push is not disabled
18231826 // Device registered with OneSignal so now make pushToken available.
18241827 XCTAssertNil (observer->last .to .pushToken );
18251828
0 commit comments