diff options
Diffstat (limited to 'spec/frontend/projects/settings/repository')
-rw-r--r-- | spec/frontend/projects/settings/repository/branch_rules/components/branch_rule_spec.js | 11 | ||||
-rw-r--r-- | spec/frontend/projects/settings/repository/branch_rules/mock_data.js | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/spec/frontend/projects/settings/repository/branch_rules/components/branch_rule_spec.js b/spec/frontend/projects/settings/repository/branch_rules/components/branch_rule_spec.js index 49c45c080b4..8d0fd390e35 100644 --- a/spec/frontend/projects/settings/repository/branch_rules/components/branch_rule_spec.js +++ b/spec/frontend/projects/settings/repository/branch_rules/components/branch_rule_spec.js @@ -20,6 +20,7 @@ describe('Branch rule', () => { }; const findDefaultBadge = () => wrapper.findByText(i18n.defaultLabel); + const findProtectedBadge = () => wrapper.findByText(i18n.protectedLabel); const findBranchName = () => wrapper.findByText(branchRulePropsMock.name); const findProtectionDetailsList = () => wrapper.findByRole('list'); const findProtectionDetailsListItems = () => wrapper.findAllByRole('listitem'); @@ -32,17 +33,23 @@ describe('Branch rule', () => { }); describe('badges', () => { - it('renders default badge', () => { + it('renders both default and protected badges', () => { expect(findDefaultBadge().exists()).toBe(true); + expect(findProtectedBadge().exists()).toBe(true); }); it('does not render default badge if isDefault is set to false', () => { createComponent({ isDefault: false }); expect(findDefaultBadge().exists()).toBe(false); }); + + it('does not render default badge if branchProtection is null', () => { + createComponent(branchRuleWithoutDetailsPropsMock); + expect(findProtectedBadge().exists()).toBe(false); + }); }); - it('does not render the protection details list if no details are present', () => { + it('does not render the protection details list when branchProtection is null', () => { createComponent(branchRuleWithoutDetailsPropsMock); expect(findProtectionDetailsList().exists()).toBe(false); }); diff --git a/spec/frontend/projects/settings/repository/branch_rules/mock_data.js b/spec/frontend/projects/settings/repository/branch_rules/mock_data.js index 6f506882c36..de7f6c8b88d 100644 --- a/spec/frontend/projects/settings/repository/branch_rules/mock_data.js +++ b/spec/frontend/projects/settings/repository/branch_rules/mock_data.js @@ -92,10 +92,7 @@ export const branchRuleWithoutDetailsPropsMock = { name: 'branch-1', isDefault: false, matchingBranchesCount: 1, - branchProtection: { - allowForcePush: false, - codeOwnerApprovalRequired: false, - }, + branchProtection: null, approvalRulesTotal: 0, statusChecksTotal: 0, }; |