Skip to content

Commit d4cb261

Browse files
authored
Merge branch 'master' into feature/itbl_track_anon_user
2 parents 9ed3cdd + 885d255 commit d4cb261

File tree

3 files changed

+93
-93
lines changed

3 files changed

+93
-93
lines changed

tests/unit-tests/AuthTests.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -562,30 +562,30 @@ class AuthTests: XCTestCase {
562562
func testAuthTokenRefreshRetryOnlyOnce() throws {
563563
throw XCTSkip("skipping this test - auth token retries should occur more than once")
564564

565-
let condition1 = expectation(description: "\(#function) - callback not called correctly in some form")
566-
condition1.expectedFulfillmentCount = 2
567-
568-
let authDelegate = createAuthDelegate({
569-
condition1.fulfill()
570-
return AuthTests.authToken
571-
})
572-
573-
let config = IterableConfig()
574-
config.authDelegate = authDelegate
575-
576-
let mockNetworkSession = MockNetworkSession(statusCode: 401,
577-
json: [JsonKey.Response.iterableCode: JsonValue.Code.invalidJwtPayload])
578-
579-
let internalAPI = InternalIterableAPI.initializeForTesting(config: config,
580-
networkSession: mockNetworkSession)
581-
582-
internalAPI.email = AuthTests.email
583-
584-
// two calls here to trigger the retry more than once
585-
internalAPI.track("event")
586-
internalAPI.track("event")
587-
588-
wait(for: [condition1], timeout: testExpectationTimeout)
565+
// let condition1 = expectation(description: "\(#function) - callback not called correctly in some form")
566+
// condition1.expectedFulfillmentCount = 2
567+
//
568+
// let authDelegate = createAuthDelegate({
569+
// condition1.fulfill()
570+
// return AuthTests.authToken
571+
// })
572+
//
573+
// let config = IterableConfig()
574+
// config.authDelegate = authDelegate
575+
//
576+
// let mockNetworkSession = MockNetworkSession(statusCode: 401,
577+
// json: [JsonKey.Response.iterableCode: JsonValue.Code.invalidJwtPayload])
578+
//
579+
// let internalAPI = InternalIterableAPI.initializeForTesting(config: config,
580+
// networkSession: mockNetworkSession)
581+
//
582+
// internalAPI.email = AuthTests.email
583+
//
584+
// // two calls here to trigger the retry more than once
585+
// internalAPI.track("event")
586+
// internalAPI.track("event")
587+
//
588+
// wait(for: [condition1], timeout: testExpectationTimeout)
589589
}
590590

591591
func testPriorAuthFailedRetryPrevention() {

tests/unit-tests/EmbeddedManagerTests.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ final class EmbeddedManagerTests: XCTestCase {
1010
func testManagerSingleDelegateUpdated() throws {
1111
throw XCTSkip("skipping this test - manager logic updated, needs to be revisited")
1212

13-
let condition1 = expectation(description: #function)
14-
15-
let mockApiClient = MockApiClient()
16-
17-
let manager = IterableEmbeddedManager(apiClient: mockApiClient,
18-
urlDelegate: nil,
19-
customActionDelegate: nil,
20-
urlOpener: MockUrlOpener(),
21-
allowedProtocols: [],
22-
enableEmbeddedMessaging: true)
23-
24-
let view1 = ViewWithUpdateDelegate(
25-
onMessagesUpdatedCallback: {
26-
condition1.fulfill()
27-
},
28-
onEmbeddedMessagingDisabledCallback: nil
29-
)
30-
31-
manager.addUpdateListener(view1)
32-
33-
mockApiClient.haveNewEmbeddedMessages()
34-
manager.syncMessages {}
35-
36-
wait(for: [condition1], timeout: 2)
13+
// let condition1 = expectation(description: #function)
14+
//
15+
// let mockApiClient = MockApiClient()
16+
//
17+
// let manager = IterableEmbeddedManager(apiClient: mockApiClient,
18+
// urlDelegate: nil,
19+
// customActionDelegate: nil,
20+
// urlOpener: MockUrlOpener(),
21+
// allowedProtocols: [],
22+
// enableEmbeddedMessaging: true)
23+
//
24+
// let view1 = ViewWithUpdateDelegate(
25+
// onMessagesUpdatedCallback: {
26+
// condition1.fulfill()
27+
// },
28+
// onEmbeddedMessagingDisabledCallback: nil
29+
// )
30+
//
31+
// manager.addUpdateListener(view1)
32+
//
33+
// mockApiClient.haveNewEmbeddedMessages()
34+
// manager.syncMessages {}
35+
//
36+
// wait(for: [condition1], timeout: 2)
3737
}
3838

3939
// getMessages

tests/unit-tests/IterableAPIResponseTests.swift

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -103,51 +103,51 @@ class IterableAPIResponseTests: XCTestCase {
103103

104104
func testRetryOnInvalidJwtPayload() throws {
105105
throw XCTSkip("skipping this test - retry logic updated, needs to be revisited")
106-
let xpectation = expectation(description: "retry on 401 with invalidJWTPayload")
107-
108-
// Mock the dependencies and requestProvider for your test
109-
let authManager = MockAuthManager()
110-
111-
let networkErrorSession = MockNetworkSession() { _ in
112-
MockNetworkSession.MockResponse(statusCode: 401,
113-
data: ["code":"InvalidJwtPayload"].toJsonData(),
114-
delay: 1)
115-
}
116-
117-
let networkSuccessSession = MockNetworkSession() { _ in
118-
MockNetworkSession.MockResponse(statusCode: 200,
119-
data: ["msg": "success"].toJsonData(),
120-
delay: 1)
121-
}
122-
123-
let urlErrorRequest = createApiClient(networkSession: networkErrorSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
124-
125-
126-
let urlSuccessRequest = createApiClient(networkSession: networkSuccessSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
127-
128-
let requestProvider: () -> Pending<SendRequestValue, SendRequestError> = {
129-
if authManager.retryWasRequested {
130-
return RequestSender.sendRequest(urlSuccessRequest, usingSession: networkSuccessSession)
131-
}
132-
return RequestSender.sendRequest(urlErrorRequest, usingSession: networkErrorSession)
133-
}
134-
135-
let result = RequestProcessorUtil.sendRequest(
136-
requestProvider: requestProvider,
137-
authManager: authManager,
138-
requestIdentifier: "TestIdentifier"
139-
)
140-
141-
result.onSuccess { value in
142-
xpectation.fulfill()
143-
XCTAssert(true)
144-
}.onError { error in
145-
if authManager.retryWasRequested {
146-
xpectation.fulfill()
147-
}
148-
}
149-
150-
waitForExpectations(timeout: testExpectationTimeout)
106+
// let xpectation = expectation(description: "retry on 401 with invalidJWTPayload")
107+
//
108+
// // Mock the dependencies and requestProvider for your test
109+
// let authManager = MockAuthManager()
110+
//
111+
// let networkErrorSession = MockNetworkSession() { _ in
112+
// MockNetworkSession.MockResponse(statusCode: 401,
113+
// data: ["code":"InvalidJwtPayload"].toJsonData(),
114+
// delay: 1)
115+
// }
116+
//
117+
// let networkSuccessSession = MockNetworkSession() { _ in
118+
// MockNetworkSession.MockResponse(statusCode: 200,
119+
// data: ["msg": "success"].toJsonData(),
120+
// delay: 1)
121+
// }
122+
//
123+
// let urlErrorRequest = createApiClient(networkSession: networkErrorSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
124+
//
125+
//
126+
// let urlSuccessRequest = createApiClient(networkSession: networkSuccessSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
127+
//
128+
// let requestProvider: () -> Pending<SendRequestValue, SendRequestError> = {
129+
// if authManager.retryWasRequested {
130+
// return RequestSender.sendRequest(urlSuccessRequest, usingSession: networkSuccessSession)
131+
// }
132+
// return RequestSender.sendRequest(urlErrorRequest, usingSession: networkErrorSession)
133+
// }
134+
//
135+
// let result = RequestProcessorUtil.sendRequest(
136+
// requestProvider: requestProvider,
137+
// authManager: authManager,
138+
// requestIdentifier: "TestIdentifier"
139+
// )
140+
//
141+
// result.onSuccess { value in
142+
// xpectation.fulfill()
143+
// XCTAssert(true)
144+
// }.onError { error in
145+
// if authManager.retryWasRequested {
146+
// xpectation.fulfill()
147+
// }
148+
// }
149+
//
150+
// waitForExpectations(timeout: testExpectationTimeout)
151151
}
152152

153153
func testResponseCode401() { // 401 = unauthorized

0 commit comments

Comments
 (0)