]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21692 QualityProfiles and PullRequestOverview clean up test logs
authorViktor Vorona <viktor.vorona@sonarsource.com>
Wed, 21 Feb 2024 15:52:23 +0000 (16:52 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 21 Feb 2024 20:02:34 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx

index d3641045d214da9d860f8da15e04cbde788c0c6a..b88188b80d9d05a6921ece49598b5c03266db276 100644 (file)
@@ -20,6 +20,7 @@
 import { screen, waitFor } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
+import BranchesServiceMock from '../../../../api/mocks/BranchesServiceMock';
 import { fetchQualityGate, getQualityGateProjectStatus } from '../../../../api/quality-gates';
 import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider';
 import { mockPullRequest } from '../../../../helpers/mocks/branch-like';
@@ -121,6 +122,12 @@ jest.mock('../../../../api/quality-gates', () => {
   };
 });
 
+const branchesHandler = new BranchesServiceMock();
+
+afterEach(() => {
+  branchesHandler.reset();
+});
+
 it('should render links correctly', async () => {
   jest.mocked(getQualityGateProjectStatus).mockResolvedValueOnce({
     status: 'OK',
index e983c6617f59c2fa413a90d6968a8dcec7dd8452..d463b47f6cddf902b692ddc9bf58192b78481a9c 100644 (file)
@@ -279,20 +279,18 @@ class ProfileActions extends React.PureComponent<Props, State> {
 
           {actions.setAsDefault &&
             (hasNoActiveRules ? (
-              <li>
-                <Tooltip
-                  placement={PopupPlacement.Left}
-                  overlay={translate('quality_profiles.cannot_set_default_no_rules')}
+              <Tooltip
+                placement={PopupPlacement.Left}
+                overlay={translate('quality_profiles.cannot_set_default_no_rules')}
+              >
+                <ItemButton
+                  className="it__quality-profiles__set-as-default"
+                  onClick={this.handleSetDefaultClick}
+                  disabled
                 >
-                  <ItemButton
-                    className="it__quality-profiles__set-as-default"
-                    onClick={this.handleSetDefaultClick}
-                    disabled
-                  >
-                    {translate('set_as_default')}
-                  </ItemButton>
-                </Tooltip>
-              </li>
+                  {translate('set_as_default')}
+                </ItemButton>
+              </Tooltip>
             ) : (
               <ItemButton
                 className="it__quality-profiles__set-as-default"