]> source.dussan.org Git - sonarqube.git/commitdiff
[NO JIRA] Fix flaky test
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 27 Sep 2022 12:40:55 +0000 (14:40 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 29 Sep 2022 20:03:14 +0000 (20:03 +0000)
server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx

index 08d22435ec7201fc5edd67f78e889af71b8a5851..edefa213b80da6b0c3140cab661779c1ee80b66a 100644 (file)
@@ -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', () => {