test(insights): Remove useLocation/usePageFilters mocks from simple tests#111497
test(insights): Remove useLocation/usePageFilters mocks from simple tests#111497
Conversation
…ests Remove unnecessary jest.mock calls for useLocation and usePageFilters hooks in tests that don't rely on specific location or page filter state. Where needed, replace with PageFiltersStore.onInitializeUrlState() to provide page filter state through the real store. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
| const setupMocks = () => { | ||
| const mockProjects = [ProjectFixture()]; | ||
| ProjectsStore.loadInitialData(mockProjects); | ||
|
|
There was a problem hiding this comment.
Missing PageFiltersStore initialization breaks enabled-images test
High Severity
The usePageFilters mock was removed from setupMocks without adding a PageFiltersStore.onInitializeUrlState(...) call as a replacement. The SampleImages component uses useSpans, which internally depends on pageFiltersReady (from PageFiltersStore.isReady). Without initialization, isReady remains false, the query stays disabled, and isPending is permanently true. This causes the "When project setting is enabled" test to hang — the loading indicator is never removed because showImages && isLoadingImages stays true. The other modified test files (webVitalsDetailPanel.spec.tsx, screenDetailsPage.spec.tsx) correctly added PageFiltersStore.onInitializeUrlState(...) but this file did not.


Remove unnecessary jest.mock calls for useLocation and usePageFilters hooks in tests that don't rely on specific location or page filter state