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';
};
});
+const branchesHandler = new BranchesServiceMock();
+
+afterEach(() => {
+ branchesHandler.reset();
+});
+
it('should render links correctly', async () => {
jest.mocked(getQualityGateProjectStatus).mockResolvedValueOnce({
status: 'OK',
{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"