diff --git a/Tests/KlaviyoSwiftTests/StateManagementTests.swift b/Tests/KlaviyoSwiftTests/StateManagementTests.swift index 2bdcc109..d31d504c 100644 --- a/Tests/KlaviyoSwiftTests/StateManagementTests.swift +++ b/Tests/KlaviyoSwiftTests/StateManagementTests.swift @@ -202,6 +202,7 @@ class StateManagementTests: XCTestCase { _ = await store.send(.flushQueue) } + @MainActor func testEmptyQueueDoesNotFlush() async throws { let apiKey = "fake-key" let initialState = KlaviyoState(apiKey: apiKey, @@ -213,6 +214,7 @@ class StateManagementTests: XCTestCase { _ = await store.send(.flushQueue) } + @MainActor func testFlushQueueWithMultipleRequests() async throws { var count = 0 // request uuids need to be unique :) @@ -255,6 +257,7 @@ class StateManagementTests: XCTestCase { } } + @MainActor func testFlushQueueDuringExponentialBackoff() async throws { var initialState = INITIALIZED_TEST_STATE() initialState.retryInfo = .retryWithBackoff(requestCount: 23, totalRetryCount: 23, currentBackoff: 200) @@ -269,6 +272,7 @@ class StateManagementTests: XCTestCase { } } + @MainActor func testFlushQueueExponentialBackoffGoesToSize() async throws { var initialState = INITIALIZED_TEST_STATE() initialState.retryInfo = .retryWithBackoff(requestCount: 23, totalRetryCount: 23, currentBackoff: Int(initialState.flushInterval) - 2) @@ -295,6 +299,7 @@ class StateManagementTests: XCTestCase { } } + @MainActor func testSendRequestWhenNotFlushing() async throws { var initialState = INITIALIZED_TEST_STATE() initialState.flushing = false @@ -305,6 +310,7 @@ class StateManagementTests: XCTestCase { // MARK: - send request + @MainActor func testSendRequestWithNoRequestsInFlight() async throws { let initialState = INITIALIZED_TEST_STATE() let store = TestStore(initialState: initialState, reducer: KlaviyoReducer()) @@ -316,6 +322,7 @@ class StateManagementTests: XCTestCase { // MARK: - Network Connectivity Changed + @MainActor func testNetworkConnectivityChanges() async throws { let initialState = INITIALIZED_TEST_STATE() let store = TestStore(initialState: initialState, reducer: KlaviyoReducer()) @@ -339,6 +346,7 @@ class StateManagementTests: XCTestCase { // MARK: - Stop + @MainActor func testStopWithRequestsInFlight() async throws { // This test is a little convoluted but essentially want to make when we stop // that we save our state. @@ -359,6 +367,7 @@ class StateManagementTests: XCTestCase { // MARK: - Test pending profile + @MainActor func testFlushWithPendingProfile() async throws { var initialState = INITIALIZED_TEST_STATE() initialState.flushing = false @@ -435,6 +444,7 @@ class StateManagementTests: XCTestCase { // MARK: - Test set profile + @MainActor func testSetProfileWithExistingProperties() async throws { var initialState = INITIALIZED_TEST_STATE() initialState.phoneNumber = "555BLOB" @@ -450,6 +460,7 @@ class StateManagementTests: XCTestCase { // MARK: - Test enqueue event + @MainActor func testEnqueueEvent() async throws { var initialState = INITIALIZED_TEST_STATE() initialState.phoneNumber = "555BLOB" @@ -461,6 +472,7 @@ class StateManagementTests: XCTestCase { } } + @MainActor func testEnqueueEventWhenInitilizingSendsEvent() async throws { let initialState = INITILIZING_TEST_STATE() let store = TestStore(initialState: initialState, reducer: KlaviyoReducer())