Skip to content

Commit

Permalink
missed some
Browse files Browse the repository at this point in the history
  • Loading branch information
ndurell committed Mar 22, 2024
1 parent c43a721 commit 8223b86
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Tests/KlaviyoSwiftTests/StateManagementTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 :)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -295,6 +299,7 @@ class StateManagementTests: XCTestCase {
}
}

@MainActor
func testSendRequestWhenNotFlushing() async throws {
var initialState = INITIALIZED_TEST_STATE()
initialState.flushing = false
Expand All @@ -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())
Expand All @@ -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())
Expand All @@ -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.
Expand All @@ -359,6 +367,7 @@ class StateManagementTests: XCTestCase {

// MARK: - Test pending profile

@MainActor
func testFlushWithPendingProfile() async throws {
var initialState = INITIALIZED_TEST_STATE()
initialState.flushing = false
Expand Down Expand Up @@ -435,6 +444,7 @@ class StateManagementTests: XCTestCase {

// MARK: - Test set profile

@MainActor
func testSetProfileWithExistingProperties() async throws {
var initialState = INITIALIZED_TEST_STATE()
initialState.phoneNumber = "555BLOB"
Expand All @@ -450,6 +460,7 @@ class StateManagementTests: XCTestCase {

// MARK: - Test enqueue event

@MainActor
func testEnqueueEvent() async throws {
var initialState = INITIALIZED_TEST_STATE()
initialState.phoneNumber = "555BLOB"
Expand All @@ -461,6 +472,7 @@ class StateManagementTests: XCTestCase {
}
}

@MainActor
func testEnqueueEventWhenInitilizingSendsEvent() async throws {
let initialState = INITILIZING_TEST_STATE()
let store = TestStore(initialState: initialState, reducer: KlaviyoReducer())
Expand Down

0 comments on commit 8223b86

Please sign in to comment.