diff --git a/tests/unit-tests/AuthTests.swift b/tests/unit-tests/AuthTests.swift index 5476a4692..d61a498d4 100644 --- a/tests/unit-tests/AuthTests.swift +++ b/tests/unit-tests/AuthTests.swift @@ -562,30 +562,30 @@ class AuthTests: XCTestCase { func testAuthTokenRefreshRetryOnlyOnce() throws { throw XCTSkip("skipping this test - auth token retries should occur more than once") - let condition1 = expectation(description: "\(#function) - callback not called correctly in some form") - condition1.expectedFulfillmentCount = 2 - - let authDelegate = createAuthDelegate({ - condition1.fulfill() - return AuthTests.authToken - }) - - let config = IterableConfig() - config.authDelegate = authDelegate - - let mockNetworkSession = MockNetworkSession(statusCode: 401, - json: [JsonKey.Response.iterableCode: JsonValue.Code.invalidJwtPayload]) - - let internalAPI = InternalIterableAPI.initializeForTesting(config: config, - networkSession: mockNetworkSession) - - internalAPI.email = AuthTests.email - - // two calls here to trigger the retry more than once - internalAPI.track("event") - internalAPI.track("event") - - wait(for: [condition1], timeout: testExpectationTimeout) +// let condition1 = expectation(description: "\(#function) - callback not called correctly in some form") +// condition1.expectedFulfillmentCount = 2 +// +// let authDelegate = createAuthDelegate({ +// condition1.fulfill() +// return AuthTests.authToken +// }) +// +// let config = IterableConfig() +// config.authDelegate = authDelegate +// +// let mockNetworkSession = MockNetworkSession(statusCode: 401, +// json: [JsonKey.Response.iterableCode: JsonValue.Code.invalidJwtPayload]) +// +// let internalAPI = InternalIterableAPI.initializeForTesting(config: config, +// networkSession: mockNetworkSession) +// +// internalAPI.email = AuthTests.email +// +// // two calls here to trigger the retry more than once +// internalAPI.track("event") +// internalAPI.track("event") +// +// wait(for: [condition1], timeout: testExpectationTimeout) } func testPriorAuthFailedRetryPrevention() { diff --git a/tests/unit-tests/EmbeddedManagerTests.swift b/tests/unit-tests/EmbeddedManagerTests.swift index 900d646a0..ec6bb5f13 100644 --- a/tests/unit-tests/EmbeddedManagerTests.swift +++ b/tests/unit-tests/EmbeddedManagerTests.swift @@ -10,30 +10,30 @@ final class EmbeddedManagerTests: XCTestCase { func testManagerSingleDelegateUpdated() throws { throw XCTSkip("skipping this test - manager logic updated, needs to be revisited") - let condition1 = expectation(description: #function) - - let mockApiClient = MockApiClient() - - let manager = IterableEmbeddedManager(apiClient: mockApiClient, - urlDelegate: nil, - customActionDelegate: nil, - urlOpener: MockUrlOpener(), - allowedProtocols: [], - enableEmbeddedMessaging: true) - - let view1 = ViewWithUpdateDelegate( - onMessagesUpdatedCallback: { - condition1.fulfill() - }, - onEmbeddedMessagingDisabledCallback: nil - ) - - manager.addUpdateListener(view1) - - mockApiClient.haveNewEmbeddedMessages() - manager.syncMessages {} - - wait(for: [condition1], timeout: 2) +// let condition1 = expectation(description: #function) +// +// let mockApiClient = MockApiClient() +// +// let manager = IterableEmbeddedManager(apiClient: mockApiClient, +// urlDelegate: nil, +// customActionDelegate: nil, +// urlOpener: MockUrlOpener(), +// allowedProtocols: [], +// enableEmbeddedMessaging: true) +// +// let view1 = ViewWithUpdateDelegate( +// onMessagesUpdatedCallback: { +// condition1.fulfill() +// }, +// onEmbeddedMessagingDisabledCallback: nil +// ) +// +// manager.addUpdateListener(view1) +// +// mockApiClient.haveNewEmbeddedMessages() +// manager.syncMessages {} +// +// wait(for: [condition1], timeout: 2) } // getMessages diff --git a/tests/unit-tests/IterableAPIResponseTests.swift b/tests/unit-tests/IterableAPIResponseTests.swift index f09a10486..852451e40 100644 --- a/tests/unit-tests/IterableAPIResponseTests.swift +++ b/tests/unit-tests/IterableAPIResponseTests.swift @@ -102,51 +102,51 @@ class IterableAPIResponseTests: XCTestCase { func testRetryOnInvalidJwtPayload() throws { throw XCTSkip("skipping this test - retry logic updated, needs to be revisited") - let xpectation = expectation(description: "retry on 401 with invalidJWTPayload") - - // Mock the dependencies and requestProvider for your test - let authManager = MockAuthManager() - - let networkErrorSession = MockNetworkSession() { _ in - MockNetworkSession.MockResponse(statusCode: 401, - data: ["code":"InvalidJwtPayload"].toJsonData(), - delay: 1) - } - - let networkSuccessSession = MockNetworkSession() { _ in - MockNetworkSession.MockResponse(statusCode: 200, - data: ["msg": "success"].toJsonData(), - delay: 1) - } - - let urlErrorRequest = createApiClient(networkSession: networkErrorSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))! - - - let urlSuccessRequest = createApiClient(networkSession: networkSuccessSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))! - - let requestProvider: () -> Pending = { - if authManager.retryWasRequested { - return RequestSender.sendRequest(urlSuccessRequest, usingSession: networkSuccessSession) - } - return RequestSender.sendRequest(urlErrorRequest, usingSession: networkErrorSession) - } - - let result = RequestProcessorUtil.sendRequest( - requestProvider: requestProvider, - authManager: authManager, - requestIdentifier: "TestIdentifier" - ) - - result.onSuccess { value in - xpectation.fulfill() - XCTAssert(true) - }.onError { error in - if authManager.retryWasRequested { - xpectation.fulfill() - } - } - - waitForExpectations(timeout: testExpectationTimeout) +// let xpectation = expectation(description: "retry on 401 with invalidJWTPayload") +// +// // Mock the dependencies and requestProvider for your test +// let authManager = MockAuthManager() +// +// let networkErrorSession = MockNetworkSession() { _ in +// MockNetworkSession.MockResponse(statusCode: 401, +// data: ["code":"InvalidJwtPayload"].toJsonData(), +// delay: 1) +// } +// +// let networkSuccessSession = MockNetworkSession() { _ in +// MockNetworkSession.MockResponse(statusCode: 200, +// data: ["msg": "success"].toJsonData(), +// delay: 1) +// } +// +// let urlErrorRequest = createApiClient(networkSession: networkErrorSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))! +// +// +// let urlSuccessRequest = createApiClient(networkSession: networkSuccessSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))! +// +// let requestProvider: () -> Pending = { +// if authManager.retryWasRequested { +// return RequestSender.sendRequest(urlSuccessRequest, usingSession: networkSuccessSession) +// } +// return RequestSender.sendRequest(urlErrorRequest, usingSession: networkErrorSession) +// } +// +// let result = RequestProcessorUtil.sendRequest( +// requestProvider: requestProvider, +// authManager: authManager, +// requestIdentifier: "TestIdentifier" +// ) +// +// result.onSuccess { value in +// xpectation.fulfill() +// XCTAssert(true) +// }.onError { error in +// if authManager.retryWasRequested { +// xpectation.fulfill() +// } +// } +// +// waitForExpectations(timeout: testExpectationTimeout) } func testResponseCode401() { // 401 = unauthorized