Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/projects/settings/branch_rules/components/view/index_spec.js')
-rw-r--r--spec/frontend/projects/settings/branch_rules/components/view/index_spec.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/frontend/projects/settings/branch_rules/components/view/index_spec.js b/spec/frontend/projects/settings/branch_rules/components/view/index_spec.js
index 27065a704e2..bc373d9deb7 100644
--- a/spec/frontend/projects/settings/branch_rules/components/view/index_spec.js
+++ b/spec/frontend/projects/settings/branch_rules/components/view/index_spec.js
@@ -16,10 +16,12 @@ import {
branchProtectionsMockResponse,
approvalRulesMock,
statusChecksRulesMock,
+ matchingBranchesCount,
} from './mock_data';
jest.mock('~/lib/utils/url_utility', () => ({
getParameterByName: jest.fn().mockReturnValue('main'),
+ mergeUrlParams: jest.fn().mockReturnValue('/branches?state=all&search=main'),
joinPaths: jest.fn(),
}));
@@ -65,6 +67,13 @@ describe('View branch rules', () => {
const findForcePushTitle = () => wrapper.findByText(I18N.allowForcePushDescription);
const findApprovalsTitle = () => wrapper.findByText(I18N.approvalsTitle);
const findStatusChecksTitle = () => wrapper.findByText(I18N.statusChecksTitle);
+ const findMatchingBranchesLink = () =>
+ wrapper.findByText(
+ sprintf(I18N.matchingBranchesLinkTitle, {
+ total: matchingBranchesCount,
+ subject: 'branches',
+ }),
+ );
it('gets the branch param from url and renders it in the view', () => {
expect(util.getParameterByName).toHaveBeenCalledWith('branch');
@@ -85,6 +94,12 @@ describe('View branch rules', () => {
expect(findBranchTitle().exists()).toBe(true);
});
+ it('renders matching branches link', () => {
+ const matchingBranchesLink = findMatchingBranchesLink();
+ expect(matchingBranchesLink.exists()).toBe(true);
+ expect(matchingBranchesLink.attributes().href).toBe('/branches?state=all&search=main');
+ });
+
it('renders a branch protection title', () => {
expect(findBranchProtectionTitle().exists()).toBe(true);
});