diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-07 21:09:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-07 21:09:16 +0300 |
commit | 38e6d9291369e346f33f52a5ab656b787ce0a2c0 (patch) | |
tree | c5137121d6cc0ff5d9372252569c10a05164b794 /spec/frontend/projects | |
parent | 2a501f63df96252295df7efe53880c5e78fa22b5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/projects')
-rw-r--r-- | spec/frontend/projects/settings/branch_rules/components/view/index_spec.js | 15 | ||||
-rw-r--r-- | spec/frontend/projects/settings/branch_rules/components/view/mock_data.js | 4 |
2 files changed, 19 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); }); diff --git a/spec/frontend/projects/settings/branch_rules/components/view/mock_data.js b/spec/frontend/projects/settings/branch_rules/components/view/mock_data.js index c07d4673344..821dba75b62 100644 --- a/spec/frontend/projects/settings/branch_rules/components/view/mock_data.js +++ b/spec/frontend/projects/settings/branch_rules/components/view/mock_data.js @@ -109,6 +109,8 @@ export const accessLevelsMockResponse = [ }, ]; +export const matchingBranchesCount = 3; + export const branchProtectionsMockResponse = { data: { project: { @@ -141,6 +143,7 @@ export const branchProtectionsMockResponse = { __typename: 'ExternalStatusCheckConnection', nodes: statusChecksRulesMock, }, + matchingBranchesCount, }, { __typename: 'BranchRule', @@ -166,6 +169,7 @@ export const branchProtectionsMockResponse = { __typename: 'ExternalStatusCheckConnection', nodes: [], }, + matchingBranchesCount, }, ], }, |