test: un-red last_visited by asserting the Home dashboard (LC-602) #559

Closed
nrupard wants to merge 1 commit from fix/LC-602-un-red-last-visited-welcome-tests into main
Owner

Summary

Un-reds main. Two tests in server/tests/last_visited.rs fail on main (HEAD 4018da48 and later): home_renders_welcome_when_no_cookie and home_welcome_renders_quick_actions.

Root cause

LC-575 made routes::home::get_home render the Home dashboard when show_dashboard is 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_counts returns every non-DM room for an admin, and a public room (the migration-seeded general) for any non-admin, so show_dashboard is 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_visited is green (6/6); clippy -D warnings clean.

Verification note

This failure pre-existed LC-587 (PR #555) and PR #554; both were merged while main was already red on these two tests. Confirmed by running them on clean main (526b6e49 and 4018da48).

#LC-602

## Summary Un-reds `main`. Two tests in `server/tests/last_visited.rs` fail on `main` (HEAD 4018da48 and later): `home_renders_welcome_when_no_cookie` and `home_welcome_renders_quick_actions`. ## Root cause LC-575 made `routes::home::get_home` render the Home dashboard when `show_dashboard` is 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_counts` returns every non-DM room for an admin, and a public room (the migration-seeded `general`) for any non-admin, so `show_dashboard` is 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_visited` is green (6/6); `clippy -D warnings` clean. ## Verification note This failure pre-existed LC-587 (PR #555) and PR #554; both were merged while `main` was already red on these two tests. Confirmed by running them on clean `main` (526b6e49 and 4018da48). #LC-602
test: un-red last_visited by asserting the Home dashboard (LC-602)
All checks were successful
check-secrets / Kingfisher (push) Successful in 4s
check-secrets / Nosey parker (push) Successful in 5s
check-secrets / TruffleHog (push) Successful in 5s
check-secrets / Kingfisher (pull_request) Successful in 7s
check-secrets / Nosey parker (pull_request) Successful in 8s
check-secrets / TruffleHog (pull_request) Successful in 9s
Check / clippy + fmt + tests (pull_request) Successful in 6m28s
Create release / Create release from merged PR (pull_request) Has been skipped
389cd36602
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>
nrupard scheduled this pull request to auto merge when all checks succeed 2026-07-19 02:59:26 +02:00
nrupard closed this pull request 2026-07-19 03:15:14 +02:00
nrupard deleted branch fix/LC-602-un-red-last-visited-welcome-tests 2026-07-19 03:15:20 +02:00
All checks were successful
check-secrets / Kingfisher (push) Successful in 4s
check-secrets / Nosey parker (push) Successful in 5s
check-secrets / TruffleHog (push) Successful in 5s
check-secrets / Kingfisher (pull_request) Successful in 7s
check-secrets / Nosey parker (pull_request) Successful in 8s
check-secrets / TruffleHog (pull_request) Successful in 9s
Check / clippy + fmt + tests (pull_request) Successful in 6m28s
Required
Details
Create release / Create release from merged PR (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!559
No description provided.