Copilot commented on code in PR #37065:
URL: https://github.com/apache/superset/pull/37065#discussion_r2692092911
##########
superset-frontend/src/dashboard/components/nativeFilters/state.test.ts:
##########
@@ -296,3 +299,59 @@ test('filter with chartsInScope takes precedence over
rootPath', () => {
const { result } = renderHook(() => useIsFilterInScope());
expect(result.current(filter)).toBe(true);
});
+
+test('dashboard-level filters without tab scope should appear in
filtersOutOfScope', () => {
+ (useSelector as jest.Mock).mockImplementation((selector: Function) => {
+ const mockState = {
+ dashboardState: { activeTabs: ['TAB_1'] },
+ dashboardLayout: {
+ present: {
+ tab1: { type: 'TAB', id: 'TAB_1' },
+ chart1: { type: 'CHART', id: 'CHART_1', parents: ['TAB_1'] },
+ },
+ },
+ };
+ return selector(mockState);
+ });
+
+ const filters: Filter[] = [
+ {
+ id: 'dashboard_level_filter',
+ name: 'Dashboard Level Filter',
+ filterType: 'filter_select',
+ type: NativeFilterType.NativeFilter,
+ scope: { rootPath: ['ROOT_ID'], excluded: [] },
Review Comment:
The test uses the literal string 'ROOT_ID' instead of importing and using
the DASHBOARD_ROOT_ID constant. This creates a potential maintenance issue if
the constant value ever changes. Consider importing DASHBOARD_ROOT_ID from
'../../util/constants' and using it here for consistency with the
implementation.
--
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]