Commit 11dd1bb1 authored by Fernando's avatar Fernando

Fix tab counts for license compliance

* Change computed prop to use value from response headers
* Add unit tests

Add change log

Fix changelog entry
parent 907466b6
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapState(LICENSE_LIST, ['initialized', 'licenses', 'reportInfo', 'listTypes']), ...mapState(LICENSE_LIST, ['initialized', 'licenses', 'reportInfo', 'listTypes', 'pageInfo']),
...mapState(LICENSE_MANAGEMENT, ['managedLicenses']), ...mapState(LICENSE_MANAGEMENT, ['managedLicenses']),
...mapGetters(LICENSE_LIST, ['isJobSetUp', 'isJobFailed', 'hasPolicyViolations']), ...mapGetters(LICENSE_LIST, ['isJobSetUp', 'isJobFailed', 'hasPolicyViolations']),
hasEmptyState() { hasEmptyState() {
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
return Boolean(this.glFeatures.licensePolicyList); return Boolean(this.glFeatures.licensePolicyList);
}, },
licenseCount() { licenseCount() {
return this.licenses.length; return this.pageInfo.total;
}, },
policyCount() { policyCount() {
return this.managedLicenses.length; return this.managedLicenses.length;
......
---
title: Add sort and order for policy violations
merge_request: 30568
author:
type: fixed
...@@ -153,6 +153,9 @@ describe('Project Licenses', () => { ...@@ -153,6 +153,9 @@ describe('Project Licenses', () => {
generatedAt: '', generatedAt: '',
status: REPORT_STATUS.ok, status: REPORT_STATUS.ok,
}, },
pageInfo: {
total: 24,
},
}, },
options: { options: {
provide: { provide: {
...@@ -176,6 +179,14 @@ describe('Project Licenses', () => { ...@@ -176,6 +179,14 @@ describe('Project Licenses', () => {
expect(wrapper.find(DetectedLicensesTable).exists()).toBe(true); expect(wrapper.find(DetectedLicensesTable).exists()).toBe(true);
}); });
it('it renders the correct count in "Detected in project" tab', () => {
expect(wrapper.vm.licenseCount).toBe(24);
});
it('it renders the correct count in "Policies" tab', () => {
expect(wrapper.vm.policyCount).toBe(2);
});
it('it renders the "Policies" table', () => { it('it renders the "Policies" table', () => {
expect(wrapper.find(LicenseManagement).exists()).toBe(true); expect(wrapper.find(LicenseManagement).exists()).toBe(true);
}); });
......
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