From: Wouter Admiraal Date: Tue, 27 Sep 2022 12:40:55 +0000 (+0200) Subject: [NO JIRA] Fix flaky test X-Git-Tag: 9.7.0.61563~151 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=516a97f0bae4ae30ccdf6db3d328cbd1939d3ffc;p=sonarqube.git [NO JIRA] Fix flaky test --- diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx index 08d22435ec7..edefa213b80 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx @@ -29,29 +29,39 @@ import ComponentNav, { ComponentNavProps } from '../ComponentNav'; it('renders correctly when there are warnings', () => { renderComponentNav({ warnings: [mockTaskWarning()] }); - expect(screen.getByText('component_navigation.last_analysis_had_warnings')).toBeInTheDocument(); + expect( + screen.getByText('component_navigation.last_analysis_had_warnings', { exact: false }) + ).toBeInTheDocument(); }); it('renders correctly when there is a background task in progress', () => { renderComponentNav({ isInProgress: true }); - expect(screen.getByText('component_navigation.status.in_progress')).toBeInTheDocument(); + expect( + screen.getByText('component_navigation.status.in_progress', { exact: false }) + ).toBeInTheDocument(); }); it('renders correctly when there is a background task pending', () => { renderComponentNav({ isPending: true }); - expect(screen.getByText('component_navigation.status.pending')).toBeInTheDocument(); + expect( + screen.getByText('component_navigation.status.pending', { exact: false }) + ).toBeInTheDocument(); }); it('renders correctly when there is a failing background task', () => { renderComponentNav({ currentTask: mockTask({ status: TaskStatuses.Failed }) }); - expect(screen.getByText('component_navigation.status.failed_X')).toBeInTheDocument(); + expect( + screen.getByText('component_navigation.status.failed_X', { exact: false }) + ).toBeInTheDocument(); }); it('renders correctly when the project binding is incorrect', () => { renderComponentNav({ projectBindingErrors: mockProjectAlmBindingConfigurationErrors() }); - expect(screen.getByText('component_navigation.pr_deco.error_detected_X')).toBeInTheDocument(); + expect( + screen.getByText('component_navigation.pr_deco.error_detected_X', { exact: false }) + ).toBeInTheDocument(); }); it('correctly returns focus to the Project Information link when the drawer is closed', () => {