diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/frontend/projects/settings/branch_rules/components/view/index_spec.js | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
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.js | 15 |
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); }); |