This is an automated email from the ASF dual-hosted git repository. rusackas pushed a commit to branch replace-jest-enzyme in repository https://gitbox.apache.org/repos/asf/superset.git
commit 4c0a2ec87f97d15ef90bb1fea0804b7c22e3d95a Author: Evan Rusackas <[email protected]> AuthorDate: Mon Feb 10 15:22:44 2025 -0700 fixing another borked test. --- .../FilterConfigurationLink.test.tsx | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterConfigurationLink/FilterConfigurationLink.test.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterConfigurationLink/FilterConfigurationLink.test.tsx index cbacb9e774..19892e5033 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterConfigurationLink/FilterConfigurationLink.test.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterConfigurationLink/FilterConfigurationLink.test.tsx @@ -16,21 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { - cleanup, - render, - screen, - userEvent, -} from 'spec/helpers/testing-library'; +import { render, screen, userEvent } from 'spec/helpers/testing-library'; import FilterConfigurationLink from '.'; -// Add cleanup after each test -afterEach(async () => { - cleanup(); - // Wait for any pending effects to complete - await new Promise(resolve => setTimeout(resolve, 0)); -}); - test('should render', () => { const { container } = render( <FilterConfigurationLink>Config link</FilterConfigurationLink>, @@ -48,12 +36,17 @@ test('should render the config link text', () => { expect(screen.getByText('Config link')).toBeInTheDocument(); }); -test('should render the modal on click', async () => { - render(<FilterConfigurationLink>Config link</FilterConfigurationLink>, { - useRedux: true, - }); +test('should render the modal on click', () => { + const showModal = jest.fn(); + render( + <FilterConfigurationLink onClick={showModal}> + Config link + </FilterConfigurationLink>, + { + useRedux: true, + }, + ); const configLink = screen.getByText('Config link'); - expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); - await userEvent.click(configLink); - expect(screen.getByRole('dialog')).toBeInTheDocument(); + userEvent.click(configLink); + expect(showModal).toHaveBeenCalled(); });
