uttrflow / uttrflow/uttrflow-swift

The sign-out action can't be tested because AppDelegate builds the real account layer itself

Open
#491 0 comments 0 reactions 0 assignees View on GitHub
area:account area:general enhancement P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

`AppDelegate` creates its account layer as `private let account = OnboardingAccountLayer.forThisBuild()` (`Sources/Uttrflow/AppDelegate.swift:42`), which uses the real Keychain and URL session in a configured build. `init(container:loginItem:...)` (lines 113-132) lets tests inject the stores, the login item and the suggestion model, but not the account.

So `carryOut(.signOut)` (lines 1608-1612, clear the profile first, tell the server afterwards, redraw) has no test, unlike the dictionary, snippet and history intents in `Tests/UttrflowTests/MainIntentWiringTests.swift`. The same applies to what the Account page shows from `knownEntitlement` (lines 1376-1378, 1457-1458).

## Why it matters

Sign-out ordering is deliberate ("signing out never waits on a network"). A refactor that awaited the server first, or forgot to clear the profile, would pass every test.

## Acceptance criteria

- `AppDelegate.init` accepts an `OnboardingAccountLayer` (defaulting to `.forThisBuild()`), following the existing injection parameters.
- A test in `MainIntentWiringTests.swift` signs out with a development account layer or fakes, and checks: the profile is cleared before the authentication service is called, and the call happens.
- A test checks the Account page's entitlement after sign-out.
- No test touches the real Keychain or network (the offline audit and existing test rules apply).

#145 describes the wider plan for tests in the app target.

Contributor guide

Open the contributing guide

Research direction

Start with Sources/Uttrflow/AppDelegate.swift, especially init(container:loginItem:...) and carryOut(.signOut), then read Tests/UttrflowTests/MainIntentWiringTests.swift for the existing injected test patterns. Add coverage using a development account layer or fake, verifying the profile is cleared before authentication is called and that the Account page shows the post-sign-out entitlement, without using the real Keychain or network.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
authentication, testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.