From 9a2d39afb02b0178a87b3397259f377c7aac118a Mon Sep 17 00:00:00 2001 From: lyndsiWilliams Date: Mon, 12 Apr 2021 16:05:56 -0500 Subject: [PATCH] Te sting implemented --- .../CRUD/data/savedquery/SavedQueryList_spec.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/superset-frontend/spec/javascripts/views/CRUD/data/savedquery/SavedQueryList_spec.jsx b/superset-frontend/spec/javascripts/views/CRUD/data/savedquery/SavedQueryList_spec.jsx index e1e5f6e10bf67..ec8b80ed8da83 100644 --- a/superset-frontend/spec/javascripts/views/CRUD/data/savedquery/SavedQueryList_spec.jsx +++ b/superset-frontend/spec/javascripts/views/CRUD/data/savedquery/SavedQueryList_spec.jsx @@ -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( @@ -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(); + }); });