Commit f9ef6bc7 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch...

Merge branch 'dpisek-fix-behavior-of-license-approval-status-on-policy-management-page' into 'master'

Fix behavior of license approvals status

See merge request gitlab-org/gitlab!37170
parents b3072dc2 498869b1
......@@ -25,7 +25,8 @@ export default {
return this.rules?.find(({ name }) => name === this.licenseCheckRuleName);
},
hasLicenseCheckRule() {
return this.licenseCheckRule !== undefined;
const { licenseCheckRule: { approvalsRequired = 0 } = {} } = this;
return approvalsRequired > 0;
},
licenseCheckStatusText() {
return this.hasLicenseCheckRule
......
---
title: 'License Compliance: Show license-approvals to be inactive if no approvals
required'
merge_request: 37170
author:
type: changed
......@@ -132,10 +132,12 @@ describe('EE Approvals LicenseCompliance', () => {
});
describe.each`
givenApprovalRule | expectedStatus
${{}} | ${'inactive'}
${{ name: 'Foo' }} | ${'inactive'}
${{ name: TEST_LOCKED_APPROVALS_RULE_NAME }} | ${'active'}
givenApprovalRule | expectedStatus
${{}} | ${'inactive'}
${{ name: 'Foo', approvalsRequired: 0 }} | ${'inactive'}
${{ name: 'Foo', approvalsRequired: 1 }} | ${'inactive'}
${{ name: TEST_LOCKED_APPROVALS_RULE_NAME, approvalsRequired: 0 }} | ${'inactive'}
${{ name: TEST_LOCKED_APPROVALS_RULE_NAME, approvalsRequired: 1 }} | ${'active'}
`('when approval rule is "$givenApprovalRule.name"', ({ givenApprovalRule, expectedStatus }) => {
beforeEach(() => {
store.modules.approvals.state.rules = [givenApprovalRule];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment