You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2026/04/10 19:48:08 UTC
(superset) branch master updated: fix(tests): fix async teardown leak in FiltersConfigModal.test.tsx (#39281)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new de40b58e105 fix(tests): fix async teardown leak in FiltersConfigModal.test.tsx (#39281)
de40b58e105 is described below
commit de40b58e1050c823167a8d98da5a49603bf4cfa1
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Fri Apr 10 12:48:01 2026 -0700
fix(tests): fix async teardown leak in FiltersConfigModal.test.tsx (#39281)
Co-authored-by: Claude Opus 4.6 <no...@anthropic.com>
---
.../FiltersConfigModal/FiltersConfigModal.test.tsx | 85 +++++++++++-----------
1 file changed, 44 insertions(+), 41 deletions(-)
diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
index 9131e591add..36f9977c2ce 100644
--- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
+++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
@@ -696,56 +696,59 @@ test.skip('updates sidebar title when filter name changes', async () => {
test('modifies the name of a filter', async () => {
jest.useFakeTimers();
- try {
- const nativeFilterConfig = [
- buildNativeFilter('NATIVE_FILTER-1', 'state', []),
- buildNativeFilter('NATIVE_FILTER-2', 'country', []),
- ];
-
- const state = {
- ...defaultState(),
- dashboardInfo: {
- metadata: {
- native_filter_configuration: nativeFilterConfig,
- },
+
+ const nativeFilterConfig = [
+ buildNativeFilter('NATIVE_FILTER-1', 'state', []),
+ buildNativeFilter('NATIVE_FILTER-2', 'country', []),
+ ];
+
+ const state = {
+ ...defaultState(),
+ dashboardInfo: {
+ metadata: {
+ native_filter_configuration: nativeFilterConfig,
},
- dashboardLayout,
- };
+ },
+ dashboardLayout,
+ };
- const onSave = jest.fn();
+ const onSave = jest.fn();
- defaultRender(state, {
- ...props,
- createNewOnOpen: false,
- onSave,
- });
+ defaultRender(state, {
+ ...props,
+ createNewOnOpen: false,
+ onSave,
+ });
- const filterNameInput = screen.getByRole('textbox', {
- name: FILTER_NAME_REGEX,
- });
+ const filterNameInput = screen.getByRole('textbox', {
+ name: FILTER_NAME_REGEX,
+ });
- await userEvent.clear(filterNameInput);
- await userEvent.type(filterNameInput, 'New Filter Name');
+ await userEvent.clear(filterNameInput);
+ await userEvent.type(filterNameInput, 'New Filter Name');
- jest.runAllTimers();
+ // Flush the 500ms debounce on the filter name input.
+ // Using advanceTimersByTime instead of runAllTimers to avoid infinite
+ // loops caused by recursive antd animation timers.
+ jest.advanceTimersByTime(1000);
- await userEvent.click(screen.getByRole('button', { name: SAVE_REGEX }));
+ // Switch back to real timers so waitFor polling works
+ jest.useRealTimers();
- await waitFor(() =>
- expect(onSave).toHaveBeenCalledWith(
- expect.objectContaining({
- filterChanges: expect.objectContaining({
- modified: expect.arrayContaining([
- expect.objectContaining({ name: 'New Filter Name' }),
- ]),
- }),
+ await userEvent.click(screen.getByRole('button', { name: SAVE_REGEX }));
+
+ await waitFor(() =>
+ expect(onSave).toHaveBeenCalledWith(
+ expect.objectContaining({
+ filterChanges: expect.objectContaining({
+ modified: expect.arrayContaining([
+ expect.objectContaining({ name: 'New Filter Name' }),
+ ]),
}),
- ),
- );
- } finally {
- jest.useRealTimers();
- }
-});
+ }),
+ ),
+ );
+}, 30000);
test('renders a filter with a chart containing BigInt values', async () => {
const nativeFilterConfig = [