test: un-red last_visited by asserting the Home dashboard (LC-602) #559
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/LC-602-un-red-last-visited-welcome-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Un-reds
main. Two tests inserver/tests/last_visited.rsfail onmain(HEAD4018da48and later):home_renders_welcome_when_no_cookieandhome_welcome_renders_quick_actions.Root cause
LC-575 made
routes::home::get_homerender the Home dashboard whenshow_dashboardis true (the user has any accessible room or DM), keeping the onboarding welcome only as the empty state for a no-room account. Both tests build the app with an admin user in the general room, so they now render the dashboard, not the welcome, and their welcome-only assertions ("Welcome", "start something new", the quick-action links) fail.Note: the welcome empty state is effectively unreachable in this test setup.
list_room_unread_countsreturns every non-DM room for an admin, and a public room (the migration-seededgeneral) for any non-admin, soshow_dashboardis always true here. Forcing the welcome would mean deleting the seeded room, which does not reflect a real deployment.Fix
Rewrite the two tests to assert the dashboard (what an authed user actually sees):
home_renders_dashboard_for_authed_user: asserts the "Catch up" card.home_dashboard_renders_cards: asserts the five-card grid (Catch up, Mentions, Threads, Direct messages, Drafts).The four last-visited-redirect tests are unchanged.
cargo test -p lets-chat-server --test last_visitedis green (6/6);clippy -D warningsclean.Verification note
This failure pre-existed LC-587 (PR #555) and PR #554; both were merged while
mainwas already red on these two tests. Confirmed by running them on cleanmain(526b6e49and4018da48).#LC-602
LC-575 made `routes::home::get_home` render the Home dashboard when the user has any accessible room or DM (`show_dashboard`), keeping the onboarding welcome only as the empty state for a no-room account. Two tests in `last_visited.rs`, `home_renders_welcome_when_no_cookie` and `home_welcome_renders_quick_actions`, build the app with an admin user in the general room, which now renders the dashboard, so their welcome-only assertions ("Welcome", "start something new", the quick-action links) failed. main was red on these two. Rewrite them to assert the dashboard, which is what an authed user actually sees: `home_renders_dashboard_for_authed_user` checks the "Catch up" card and `home_dashboard_renders_cards` checks the five-card grid (Catch up, Mentions, Threads, Direct messages, Drafts). The welcome empty state is in fact unreachable in this setup: an admin sees every room and a non-admin still sees the seeded public general room, so `show_dashboard` is always true here; forcing the welcome would mean deleting the seeded room, which does not reflect a real deployment. The four last-visited-redirect tests are unchanged. `cargo test --test last_visited` is green and `clippy -D warnings` is clean. #LC-602 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>Pull request closed