File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed
swift-sdk.xcodeproj/xcshareddata/xcschemes
tests/swift-sdk-swift-tests Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 106
106
BlueprintName = " swift-sdk-swift-tests"
107
107
ReferencedContainer = " container:swift-sdk.xcodeproj" >
108
108
</BuildableReference >
109
- <SkippedTests >
110
- <Test
111
- Identifier = " InboxSessionManagerTests" >
112
- </Test >
113
- </SkippedTests >
114
109
</TestableReference >
115
110
<TestableReference
116
111
skipped = " NO" >
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ class InboxSessionManager {
26
26
return sessionStartInfo != nil
27
27
}
28
28
29
+ init ( provideInAppManager: @escaping @autoclosure ( ) -> IterableInAppManagerProtocol = IterableAPI . inAppManager) {
30
+ self . provideInAppManager = provideInAppManager
31
+ }
32
+
29
33
func updateVisibleRows( visibleRows: [ InboxImpressionTracker . RowInfo ] ) {
30
34
guard let impressionTracker = impressionTracker else {
31
35
ITBError ( " Expecting impressionTracker here. " )
@@ -47,8 +51,8 @@ class InboxSessionManager {
47
51
48
52
sessionStartInfo = SessionStartInfo ( id: IterableUtil . generateUUID ( ) ,
49
53
startTime: Date ( ) ,
50
- totalMessageCount: IterableAPI . inAppManager . getInboxMessages ( ) . count,
51
- unreadMessageCount: IterableAPI . inAppManager . getUnreadInboxMessagesCount ( ) )
54
+ totalMessageCount: provideInAppManager ( ) . getInboxMessages ( ) . count,
55
+ unreadMessageCount: provideInAppManager ( ) . getUnreadInboxMessagesCount ( ) )
52
56
impressionTracker = InboxImpressionTracker ( )
53
57
updateVisibleRows ( visibleRows: visibleRows)
54
58
}
@@ -67,4 +71,6 @@ class InboxSessionManager {
67
71
68
72
return sessionInfo
69
73
}
74
+
75
+ private let provideInAppManager : ( ) -> IterableInAppManagerProtocol
70
76
}
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ class InboxSessionManagerTests: XCTestCase {
18
18
}
19
19
20
20
func testSessionIsTracking( ) {
21
- let inboxSessionManager = InboxSessionManager ( )
21
+ let internalApi = IterableAPIInternal . initializeForTesting ( )
22
+ let inboxSessionManager = InboxSessionManager ( provideInAppManager: internalApi. inAppManager)
22
23
23
24
XCTAssertNil ( inboxSessionManager. sessionStartInfo)
24
25
XCTAssertFalse ( inboxSessionManager. isTracking)
@@ -35,7 +36,8 @@ class InboxSessionManagerTests: XCTestCase {
35
36
}
36
37
37
38
func testSessionInfoStartAndEnd( ) {
38
- let inboxSessionManager = InboxSessionManager ( )
39
+ let internalApi = IterableAPIInternal . initializeForTesting ( )
40
+ let inboxSessionManager = InboxSessionManager ( provideInAppManager: internalApi. inAppManager)
39
41
40
42
inboxSessionManager. startSession ( visibleRows: [ ] )
41
43
@@ -69,7 +71,8 @@ class InboxSessionManagerTests: XCTestCase {
69
71
let rowInfo1 = InboxImpressionTracker . RowInfo ( messageId: IterableUtil . generateUUID ( ) , silentInbox: false )
70
72
let rowInfo2 = InboxImpressionTracker . RowInfo ( messageId: IterableUtil . generateUUID ( ) , silentInbox: true )
71
73
72
- let inboxSessionManager = InboxSessionManager ( )
74
+ let internalApi = IterableAPIInternal . initializeForTesting ( )
75
+ let inboxSessionManager = InboxSessionManager ( provideInAppManager: internalApi. inAppManager)
73
76
74
77
let initialVisibleImpressions = [ rowInfo1]
75
78
You can’t perform that action at this time.
0 commit comments