Add unit coverage for the #752 agents-view routing/hook layer - #847
Merged
Merged
Conversation
Covers the previously untested whiteboard-era routing pieces: - agent-routes.test.ts pins the three agent URL helpers to their literal paths (the contract shared by the router config, useMatch patterns, and navigate call sites). - use-agents-view-routing.test.tsx drives the hook through a real MemoryRouter: invalid-agent redirect gating (loading / validated id) and its replace semantics probed via history back-navigation, legacy feedback/review deep-link collapse, tab match flags, and onTabChange navigation including its replace behavior and no-agent no-op. - use-whiteboard.test.tsx covers the query-key shape, the enabled gate on a null agent id, the versioned endpoint URL, staleTime-Infinity remount caching, and per-agent cache separation. A 13-mutant battery against the three source files is fully caught. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recurring test-enforcer run. Local suite was green on first pass (10th consecutive run): check ok; unit server 2362 pass / 8 skip, web 481→500, extension 60, scripts 4; E2E 174 pass / 12 skip (run twice, 1.1m). CI scan clean — all recent failures are known branch-local issues, no flakes. With the suite stable, this run closes the
next_focuscoverage gap: the #752 whiteboard-era routing/hook layer, previously untested.Tests added (19 → 18 after review dedup)
apps/web/src/lib/agent-routes.test.ts— pins the three agent URL helpers to their literal paths, the contract shared by the router config inApp.tsx, theuseMatchpatterns, and everynavigate()call site.apps/web/src/hooks/use-agents-view-routing.test.tsx(11 tests) — drives the hook through a realMemoryRouterwith a location/navigate probe instead of mocking the router:agentsLoaded, respects a validated id, no-ops on bare/agents, and itsreplace: truesemantics are probed by clearingrouteAgentId(mirroringuseParamsafter the redirect) and asserting back-navigation cannot resurrect the dead agent URL/feedback/:itemIdand/review/:summaryAgentIddeep links collapse onto the agent route, gated on loadchangesMatch/whiteboardMatchflags for all three tab locationsonTabChangenavigation across all three tabs, its replace-not-push history behavior, and the no-route-agent no-opapps/web/src/hooks/use-whiteboard.test.tsx(6 tests) — query-key shape,enabledgate stays idle on a null agent id, versioned endpoint URL asserted, null→id transition starts the fetch,staleTime: Infinityremount serves cache without refetching, and per-agent cache separation.Verification
replace: truefrom the invalid-agent redirect) initially survived because the redirect effect re-fires and masks the pushed entry; the test was strengthened with a double back-navigation probe rather than weakening the assertion.apiMock.mockReset()inafterEach—vi.restoreAllMocks()stops resetting module-factoryvi.fn()mocks in vitest 3), applied along with two nits (removed a redundant assertion-implied test, replaced anas Promise<never>cast with typedmockResolvedValueOncequeues).finalize:webclean, E2E 174 pass / 12 skip.🤖 Generated with Claude Code