test(worker): Account — fill gaps + lifecycle test

This commit is contained in:
Bas van Rossem
2026-07-23 14:07:14 +02:00
parent 13cbc50c4f
commit 32bdaa3e31
2 changed files with 50 additions and 0 deletions

View File

@@ -311,3 +311,19 @@ Guaranteed behaviors:
`"Kan de export niet openen"` when the response is not ok.
- Lifecycle (`src/screens/History.test.tsx`): the list renders a completed session showing both its
worked duration and its `Pauze` line, then the export action invokes the download path.
## Account — worker client
Src covered (worker `apps/worker`): `src/screens/Account.tsx` — 100% stmts/branch/funcs/lines.
No `c8 ignore`s needed.
Guaranteed behaviors:
- Account renders the Dutch header (`Account`) and, once `GET /api/me` resolves, shows the signed-in
user's name and email from `useMe()`.
- The fallback message `Kon accountgegevens niet laden.` shows when the query resolves without a
`user` (and the name/email are then absent).
- Clicking `Uitloggen` calls `signOut`, which clears the stored bearer token.
- Lifecycle (`src/screens/Account.test.tsx`): from the authenticated app on the Account screen,
clicking `Uitloggen` flips the auth context to unauthenticated so the login form
(`E-mailadres`) renders and the `Uitloggen` button is gone (token cleared).