rtexelm commented on code in PR #27429: URL: https://github.com/apache/superset/pull/27429#discussion_r1521980917
########## superset-frontend/src/features/home/ChartTable.test.tsx: ########## @@ -68,64 +69,53 @@ describe('ChartTable', () => { showThumbnails: false, }; - let wrapper: ReactWrapper; + const otherTabProps = { + ...mockedProps, + otherTabData: mockCharts, + }; + + const mineTabProps = { + ...mockedProps, + mine: mockCharts, + }; + + const renderOptions = { + useRedux: true, + useRouter: true, + }; - beforeEach(async () => { - act(() => { - wrapper = mount(<ChartTable store={store} {...mockedProps} />); + const renderChartTable = (props: any) => + act(async () => { + render(<ChartTable {...props} />, renderOptions); }); - await waitForComponentToPaint(wrapper); - }); - it('renders', () => { - expect(wrapper.find(ChartTable)).toExist(); + it('renders with EmptyState if no data present', async () => { + await renderChartTable(mockedProps); + expect(screen.getAllByRole('tab')).toHaveLength(3); + expect( + screen.getByText(/other charts will appear here/i), + ).toBeInTheDocument(); }); it('fetches chart favorites and renders chart cards', async () => { - act(() => { - const handler = wrapper.find('[role="tab"] a').at(0).prop('onClick'); - if (handler) { - handler({} as any); - } + await renderChartTable(mockedProps); + fireEvent.click(screen.getByText(/favorite/i)); Review Comment: @justinpark sent [this article ](https://stackoverflow.com/questions/61080116/ant-design-v4-breaks-react-testing-library-tests-for-select-and-autocomplete). Switching to `userEvent` -- 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. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org