Repository navigation
refactor(admin): the dashboard's tests split into one file per flow - #605
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
`web/admin/tests.rs` was 2,406 lines. It becomes `tests/`: `mod.rs` keeps the imports, constants and the `Harness`, and sessions, the frame, accounts, clients, the service's own lists and announcements each get a file. A pure move: no test or fixture changed.
16a7602 to
b817cb1
Compare
Part of #544
apps/auth-service/src/web/admin/tests.rswas 2,406 lines, the largest hand-written file in the repository, and too long to read in one sitting. It is now atests/directory, asdocs/dev/rust-conventions.mdasks for a test file that outgrows one read.tests/mod.rskeeps the imports, the constants and theHarness, plus itsactor_of, which tests in three files use. Each flow has its own file, withuse super::*asadmin/tests/does:sessions.rs: signing in through auth's handoff page, the dashboard's confirmation, and the admin listener.frame.rs: what every page shares, such as the crumb, the top bar, the sidebar, the error page and the attention cache.accounts.rs: an account's page, its changes and settings, granting rights, and messages.clients.rs: clients and their approved origins.operations.rs: audit, invitations, deliveries (with theUnsentchannel), signing keys, handles and alerts.announcements.rs: drafting and sending announcements.This is a pure move, kept in its own pull request so the fixture clean-up that touches this file can rebase onto it. No test or fixture changed. The only edited line is
tests/mod.rs's import of the dashboard, which now also namesAttentionandAttentionCache, so the attention-cache test'ssuper::AttentionCachestill resolves from its new file. A script checked that every non-blank line of the old file's body appears exactly once across the new files. The 39 tests keep their function names; only their module path gains the file's name, e.g.web::admin::tests::sessions::signing_in_asks_auth_for_a_passkey_once.just db test -E 'test(/^web::admin::/)'.Checks:
just fmt(no change to the moved code);cargo clippy -p auth-service --all-targetswith and without--all-features(-D warnings);just db test -E 'test(/^web::admin::/)'.Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)
Scope: Test module layout (
apps/auth-service/src/web/admin/)tests.rs(-2425 lines). Its admin dashboard integration tests move to atests/directory.tests/mod.rs(+250). It keeps the shared imports, constants,Harness, andactor_ofhelper, and declares six flow modules. The only edit outside the moved code addsAttentionandAttentionCacheto the dashboard import, sosuper::AttentionCachestill resolves.sessions.rs(+443): handoff, sign-in/sign-out, session expiry, passkey confirmation, admin listener restrictions.frame.rs(+168): error trace IDs, breadcrumbs, notification bell, search,AttentionCache.accounts.rs(+773): account-page changes, recovery, grants, deletion, messages.clients.rs(+308): origins and client lifecycle.operations.rs(+325): audit, invitations, deliveries, signing keys, handles, alerts.announcements.rs(+187): announcement drafting, confirmation, sending, inbox view.Scope: Documentation (
docs/dev/)extending/account-setting.md: test location changes toweb/admin/tests/accounts.rs(+1/-1).extending/admin-operation.md: test location changes toweb/admin/tests/(+1/-1).security/account-recovery.md: test name changes toaccounts::an_accounts_page_names_no_passkey(+1/-1).Totals
just fmt,cargo clippy -p auth-service --all-targets(with and without--all-features), andjust db test -E 'test(/^web::admin::/)'with 39 passing tests. I did not run these checks or verify the 39-test count.