Commit d7f51165 authored by Alexander Turinske's avatar Alexander Turinske

Refactor header to abstract out reusable strings

- move state string to constant
- update test name
- move changelog to ee
parent ddd9651c
......@@ -82,7 +82,9 @@ export default {
},
canDownloadPatch() {
return (
this.vulnerability.state !== 'resolved' && !this.vulnerability.hasMr && this.hasRemediation
this.vulnerability.state !== VULNERABILITY_STATE_OBJECTS.resolved.state &&
!this.vulnerability.hasMr &&
this.hasRemediation
);
},
hasIssue() {
......@@ -105,7 +107,8 @@ export default {
},
showResolutionAlert() {
return (
this.vulnerability.resolved_on_default_branch && this.vulnerability.state !== 'resolved'
this.vulnerability.resolved_on_default_branch &&
this.vulnerability.state !== VULNERABILITY_STATE_OBJECTS.resolved.state
);
},
},
......
......@@ -3,18 +3,21 @@ import { s__ } from '~/locale';
export const VULNERABILITY_STATE_OBJECTS = {
dismissed: {
action: 'dismiss',
state: 'dismissed',
statusBoxStyle: 'upcoming',
displayName: s__('VulnerabilityManagement|Dismiss'),
description: s__('VulnerabilityManagement|Will not fix or a false-positive'),
},
confirmed: {
action: 'confirm',
state: 'confirmed',
statusBoxStyle: 'closed',
displayName: s__('VulnerabilityManagement|Confirm'),
description: s__('VulnerabilityManagement|A true-positive and will fix'),
},
resolved: {
action: 'resolve',
state: 'resolved',
statusBoxStyle: 'open',
displayName: s__('VulnerabilityManagement|Resolved'),
description: s__('VulnerabilityManagement|Verified as fixed or mitigated'),
......
......@@ -287,7 +287,7 @@ describe('Vulnerability Header', () => {
});
});
describe('can download download patch', () => {
describe('can download patch', () => {
beforeEach(() => {
createWrapper({
finding: getFinding({ shouldShowMergeRequestButton: true }),
......@@ -302,7 +302,6 @@ describe('Vulnerability Header', () => {
it('emits downloadPatch when download patch button is clicked', () => {
const glDeprecatedButton = findGlDeprecatedButton();
expect(glDeprecatedButton.exists()).toBe(true);
glDeprecatedButton.vm.$emit('click');
return wrapper.vm.$nextTick().then(() => {
expect(download).toHaveBeenCalledWith({ fileData: diff, fileName: `remediation.patch` });
......
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