rusackas commented on a change in pull request #15017:
URL: https://github.com/apache/superset/pull/15017#discussion_r647796386



##########
File path: 
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
##########
@@ -17,198 +17,289 @@
  * under the License.
  */
 import { Preset } from '@superset-ui/core';
-import { SelectFilterPlugin, TimeFilterPlugin } from 'src/filters/components';
-import { render, cleanup, screen } from 'spec/helpers/testing-library';
-import { Provider } from 'react-redux';
 import {
-  getMockStore,
-  mockStore,
-  stateWithoutNativeFilters,
-} from 'spec/fixtures/mockStore';
+  SelectFilterPlugin,
+  RangeFilterPlugin,
+  TimeFilterPlugin,
+  TimeColumnFilterPlugin,
+  TimeGrainFilterPlugin,
+} from 'src/filters/components';
+import { render, screen, waitFor } from 'spec/helpers/testing-library';
 import fetchMock from 'fetch-mock';
 import React from 'react';
-import userEvent from '@testing-library/user-event';
-import { testWithId } from 'src/utils/testUtils';
-import { waitFor } from '@testing-library/react';
+import userEvent, { specialChars } from '@testing-library/user-event';
 import {
-  FILTERS_CONFIG_MODAL_TEST_ID,
   FiltersConfigModal,
+  FiltersConfigModalProps,
 } from './FiltersConfigModal';
 
-jest.useFakeTimers();
-
 class MainPreset extends Preset {
   constructor() {
     super({
       name: 'Legacy charts',
       plugins: [
-        new TimeFilterPlugin().configure({ key: 'filter_time' }),
         new SelectFilterPlugin().configure({ key: 'filter_select' }),
+        new RangeFilterPlugin().configure({ key: 'filter_range' }),
+        new TimeFilterPlugin().configure({ key: 'filter_time' }),
+        new TimeColumnFilterPlugin().configure({ key: 'filter_timecolumn' }),
+        new TimeGrainFilterPlugin().configure({ key: 'filter_timegrain' }),
       ],
     });
   }
 }
 
-const getTestId = testWithId<string>(FILTERS_CONFIG_MODAL_TEST_ID, true);
+const initialStoreState = {
+  datasources: [{ id: 1, table_name: 'Datasource 1' }],
+};
 
-describe('FilterConfigModal', () => {
-  new MainPreset().register();
-  const onSave = jest.fn();
-  const newFilterProps = {
-    isOpen: true,
-    initialFilterId: undefined,
-    createNewOnOpen: true,
-    onSave,
-    onCancel: jest.fn(),
-  };
-  fetchMock.get(
-    'glob:*/api/v1/dataset/?q=*',
-    {
-      count: 1,
-      ids: [11],
-      label_columns: {
-        id: 'Id',
-        table_name: 'Table Name',
-      },
-      list_columns: ['id', 'table_name'],
-      order_columns: ['table_name'],
-      result: [
-        {
-          id: 11,
-          owners: [],
-          table_name: 'birth_names',
-        },
-      ],
-    },
-    { overwriteRoutes: true },
-  );
-  fetchMock.get(
-    'glob:*/api/v1/dataset/11',
-    {
-      description_columns: {},
-      id: 3,
-      label_columns: {
-        columns: 'Columns',
-        table_name: 'Table Name',
-      },
-      result: {
-        columns: [
-          {
-            column_name: 'name',
-            groupby: true,
-            id: 334,
-          },
-        ],
-        table_name: 'birth_names',
+fetchMock.get('glob:*/api/v1/dataset/1', {
+  description_columns: {},

Review comment:
       This mock looks an awful lot like the one in `Filterbar.test.tsx` - 
should we recycle/export?




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to