Skip to content

Commit

Permalink
PM-13694: Set carousel shown prior to account setup screens (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-livefront authored Oct 28, 2024
1 parent 6580bec commit 4fa75b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions BitwardenShared/UI/Auth/AuthRouterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,21 @@ final class AuthRouterTests: BitwardenTestCase { // swiftlint:disable:this type_
XCTAssertTrue(stateService.introCarouselShown)
}

/// `handleAndRoute(_ :)` redirects `.didCompleteAuth` to `.vaultUnlockSetup` and sets the
/// carousel shown flag if the carousel feature flag is on and the carousel hasn't been shown yet.
@MainActor
func test_handleAndRoute_didCompleteAuth_carouselShown_vaultUnlockSetup() async {
authRepository.activeAccount = .fixture()
configService.featureFlagsBool[.nativeCarouselFlow] = true
stateService.activeAccount = .fixture()
stateService.accountSetupVaultUnlock["1"] = .incomplete

let route = await subject.handleAndRoute(.didCompleteAuth)

XCTAssertEqual(route, .vaultUnlockSetup(.createAccount))
XCTAssertTrue(stateService.introCarouselShown)
}

/// `handleAndRoute(_:)` redirects `.didCompleteAuth` to complete the auth flow if the account
/// doesn't require an updated password.
func test_handleAndRoute_didCompleteAuth_complete() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ extension AuthRouter {
return .landing
}

await setCarouselShownIfEnabled()

if account.profile.forcePasswordResetReason != nil {
return .updateMasterPassword
}
Expand All @@ -41,7 +43,6 @@ extension AuthRouter {
}
}

await setCarouselShownIfEnabled()
return .complete
}

Expand Down

0 comments on commit 4fa75b0

Please sign in to comment.