test(ui): remove useLocation mock from useLocationQuery tests#111567
test(ui): remove useLocation mock from useLocationQuery tests#111567
Conversation
Replace direct useLocation mocks with renderHookWithProviders and route-backed query state, including router navigation for identity stability assertions. Made-with: Cursor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| rerender(props); | ||
|
|
||
| router.navigate('/mock-pathname/?name=Adam&titles=Mr.&titles=Dr.'); | ||
| await waitFor(() => expect(result.current.name).toBe('Adam')); |
There was a problem hiding this comment.
waitFor assertion is a no-op for navigation verification
Low Severity
The waitFor on line 156 checks result.current.name equals 'Adam', but this was already true from the initial render (the initial query has name: 'Adam'). This means waitFor resolves immediately without actually confirming that the navigation re-render occurred. The captured second reference could trivially equal first because no re-render has been observed, making the expect(first).toBe(second) assertion potentially pass for the wrong reason. Currently this works only because router.navigate synchronously flushes via act(), but the waitFor doesn't guard the intent of the test.
There was a problem hiding this comment.
i think thats okay we don't need to count renders


migrate
useLocationQuerytests from mockeduseLocationtorenderHookWithProviders