@@ -46,27 +46,35 @@ final class OneSignalNotificationsTests: XCTestCase {
46
46
// NotificationManager Start to register lifecycle listener
47
47
OSNotificationsManager . start ( )
48
48
// Set badge count > 0
49
- print ( " 💛 testClearBadgesWhenAppEntersForeground setting applicationIconBadgeNumber " )
49
+ print ( " 💛 testClearBadgesWhenAppEntersForeground setting applicationIconBadgeNumber = 1 " )
50
50
UIApplication . shared. applicationIconBadgeNumber = 1
51
+ print ( " 🥑 applicationIconBadgeNumber is \( UIApplication . shared. applicationIconBadgeNumber) " )
52
+
51
53
// Then background the app
52
54
OneSignalCoreMocks . backgroundApp ( )
53
55
// Foreground the app
54
56
OneSignalCoreMocks . foregroundApp ( )
55
57
// Ensure that badge count == 0
58
+ print ( " 🥑 applicationIconBadgeNumber now is \( UIApplication . shared. applicationIconBadgeNumber) " )
59
+
56
60
XCTAssertEqual ( UIApplication . shared. applicationIconBadgeNumber, 0 )
57
61
}
58
62
59
63
func testDontclearBadgesWhenAppBecomesActive( ) throws { // Unable to make it fail alone
60
64
// NotificationManager Start to register lifecycle listener
61
65
OSNotificationsManager . start ( )
62
66
// Set badge count > 0
63
- print ( " 💛 testDontclearBadgesWhenAppBecomesActive setting applicationIconBadgeNumber " )
67
+ print ( " 💛 testDontclearBadgesWhenAppBecomesActive setting applicationIconBadgeNumber = 1 " )
64
68
UIApplication . shared. applicationIconBadgeNumber = 1
69
+ print ( " 🥑 applicationIconBadgeNumber is \( UIApplication . shared. applicationIconBadgeNumber) " )
70
+
65
71
// Then resign active
66
72
OneSignalCoreMocks . resignActive ( )
67
73
// App becomes active the app
68
74
OneSignalCoreMocks . becomeActive ( )
69
75
// Ensure that badge count == 1
76
+ print ( " 🥑 applicationIconBadgeNumber now is \( UIApplication . shared. applicationIconBadgeNumber) " )
77
+
70
78
XCTAssertEqual ( UIApplication . shared. applicationIconBadgeNumber, 1 )
71
79
}
72
80
//
0 commit comments