-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into noah/CHNL-6823/new-headers-for-ios
- Loading branch information
Showing
6 changed files
with
135 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,13 @@ class StateManagementEdgeCaseTests: XCTestCase { | |
} | ||
} | ||
|
||
func testSetEmptyEmail() async throws { | ||
let initialState = INITIALIZED_TEST_STATE() | ||
let store = TestStore(initialState: initialState, reducer: KlaviyoReducer()) | ||
|
||
_ = await store.send(.setEmail("")) | ||
} | ||
|
||
// MARK: - Set External Id | ||
|
||
@MainActor | ||
|
@@ -182,6 +189,13 @@ class StateManagementEdgeCaseTests: XCTestCase { | |
} | ||
} | ||
|
||
func testSetEmptyExternalId() async throws { | ||
let initialState = INITIALIZED_TEST_STATE() | ||
let store = TestStore(initialState: initialState, reducer: KlaviyoReducer()) | ||
|
||
_ = await store.send(.setExternalId("")) | ||
} | ||
|
||
// MARK: - Set Phone number | ||
|
||
@MainActor | ||
|
@@ -212,6 +226,13 @@ class StateManagementEdgeCaseTests: XCTestCase { | |
} | ||
} | ||
|
||
func testSetEmptyPhoneNumber() async throws { | ||
let initialState = INITIALIZED_TEST_STATE() | ||
let store = TestStore(initialState: initialState, reducer: KlaviyoReducer()) | ||
|
||
_ = await store.send(.setPhoneNumber("")) | ||
} | ||
|
||
// MARK: - Set Push Token | ||
|
||
@MainActor | ||
|
@@ -353,4 +374,31 @@ class StateManagementEdgeCaseTests: XCTestCase { | |
_ = await store.send(.enqueueProfile(profile)) | ||
await fulfillment(of: [expection]) | ||
} | ||
|
||
func testSetProfileWithEmptyStringIdentifiers() async throws { | ||
let initialState = KlaviyoState( | ||
apiKey: TEST_API_KEY, | ||
email: "[email protected]", | ||
anonymousId: environment.analytics.uuid().uuidString, | ||
phoneNumber: "99999999", | ||
externalId: "12345", | ||
pushTokenData: .init(pushToken: "blob_token", | ||
pushEnablement: .authorized, | ||
pushBackground: .available, | ||
deviceData: .init(context: environment.analytics.appContextInfo())), | ||
queue: [], | ||
requestsInFlight: [], | ||
initalizationState: .initialized, | ||
flushing: true) | ||
|
||
let store = TestStore(initialState: initialState, reducer: KlaviyoReducer()) | ||
|
||
_ = await store.send(.enqueueProfile(Profile(email: "", phoneNumber: "", externalId: ""))) { | ||
$0.email = nil // since we reset state | ||
$0.phoneNumber = nil // since we reset state | ||
$0.externalId = nil // since we reset state | ||
$0.enqueueProfileOrTokenRequest() | ||
$0.pushTokenData = nil | ||
} | ||
} | ||
} |