Skip to content

Commit 885d255

Browse files
authored
Merge pull request #847 from Iterable/chore/comment-outdated-tests-logic
🤫 Commenting out these tests logic to silence warnings.
2 parents 4e08441 + a844c78 commit 885d255

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
@@ -102,51 +102,51 @@ class IterableAPIResponseTests: XCTestCase {
102102

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

152152
func testResponseCode401() { // 401 = unauthorized

0 commit comments

Comments
 (0)