fix: Fixed saved query export (#14086)

* Fixed saved query export

* Te
sting implemented
This commit is contained in:
Lyndsi Kay Williams
2021-04-13 10:09:08 -05:00
committed by GitHub
parent 4b23d0ecca
commit 6392d41ac9
3 changed files with 26 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ import { render, screen, cleanup } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
import { QueryParamProvider } from 'use-query-params';
import { act } from 'react-dom/test-utils';
import { handleBulkSavedQueryExport } from 'src/views/CRUD/utils';
import * as featureFlags from 'src/featureFlags';
import SavedQueryList from 'src/views/CRUD/data/savedquery/SavedQueryList';
import SubMenu from 'src/components/Menu/SubMenu';
@@ -95,6 +96,9 @@ fetchMock.get(queriesDistinctEndpoint, {
result: [],
});
// Mock utils module
jest.mock('src/views/CRUD/utils');
describe('SavedQueryList', () => {
const wrapper = mount(
<Provider store={store}>
@@ -245,4 +249,12 @@ describe('RTL', () => {
});
expect(exportTooltip).toBeInTheDocument();
});
it('runs handleBulkSavedQueryExport when export is clicked', () => {
// Grab Export action button and mock mouse clicking it
const exportActionButton = screen.getAllByRole('button')[17];
userEvent.click(exportActionButton);
expect(handleBulkSavedQueryExport).toHaveBeenCalled();
});
});