Copilot commented on code in PR #40929:
URL: https://github.com/apache/superset/pull/40929#discussion_r3391675079
##########
superset-frontend/src/dashboard/containers/DashboardPage.test.tsx:
##########
@@ -133,9 +134,11 @@ jest.mock('src/dashboard/util/activeDashboardFilters', ()
=> ({
}));
jest.mock('src/utils/urlUtils', () => ({
- getUrlParam: () => null,
+ getUrlParam: jest.fn().mockReturnValue(null),
}));
+const mockGetUrlParam = getUrlParam as jest.Mock;
+
Review Comment:
`getUrlParam` is mocked as a module-level `jest.fn()` and these new tests
override its implementation via `mockImplementation(...)`. Because the suite
uses `jest.clearAllMocks()` (which does not reset implementations) and
`jest.restoreAllMocks()` (which doesn’t restore `jest.fn()` module mocks), the
overridden `getUrlParam` implementation can leak into subsequent tests in this
file, causing order-dependent failures. Reset `mockGetUrlParam` back to the
default `null` return between tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]