Commit 0d5da07c authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch...

Merge branch '8343-dismissed-state-not-correctly-set-in-vulnerability-modal-on-group-security-dashboard' into 'master'

Resolve "Dismissed state not correctly set in Vulnerability modal on Group Security Dashboard"

Closes #8343

See merge request gitlab-org/gitlab-ee!8364
parents bfae6d19 8d102f26
......@@ -63,6 +63,7 @@ export default {
Vue.set(state.modal.data.instances, 'value', vulnerability.instances);
Vue.set(state.modal, 'vulnerability', vulnerability);
Vue.set(state.modal.vulnerability, 'hasIssue', Boolean(vulnerability.issue_feedback));
Vue.set(state.modal.vulnerability, 'isDismissed', Boolean(vulnerability.dismissal_feedback));
Vue.set(state.modal, 'error', null);
},
[types.REQUEST_CREATE_ISSUE](state) {
......
---
title: Fixes a dismissed vulnerability bug on the group security dashboard
merge_request: 8343
author:
type: fixed
......@@ -132,59 +132,86 @@ describe('vulnerabilities module mutations', () => {
});
describe('SET_MODAL_DATA', () => {
const vulnerability = mockData[0];
let payload;
let state;
beforeEach(() => {
state = createState();
payload = { vulnerability };
mutations[types.SET_MODAL_DATA](state, payload);
});
it('should set the modal title', () => {
expect(state.modal.title).toEqual(vulnerability.name);
});
it('should set the modal description', () => {
expect(state.modal.data.description.value).toEqual(vulnerability.description);
});
it('should set the modal project', () => {
expect(state.modal.data.project.value).toEqual(vulnerability.project.full_name);
expect(state.modal.data.project.url).toEqual(vulnerability.project.full_path);
});
it('should set the modal file', () => {
expect(state.modal.data.file.value).toEqual(vulnerability.location.file);
});
it('should set the modal identifiers', () => {
expect(state.modal.data.identifiers.value).toEqual(vulnerability.identifiers);
});
it('should set the modal severity', () => {
expect(state.modal.data.severity.value).toEqual(vulnerability.severity);
});
it('should set the modal confidence', () => {
expect(state.modal.data.confidence.value).toEqual(vulnerability.confidence);
});
it('should set the modal solution', () => {
expect(state.modal.data.solution.value).toEqual(vulnerability.solution);
});
it('should set the modal links', () => {
expect(state.modal.data.links.value).toEqual(vulnerability.links);
});
it('should set the modal instances', () => {
expect(state.modal.data.instances.value).toEqual(vulnerability.instances);
});
it('should set the modal vulnerability', () => {
expect(state.modal.vulnerability).toEqual(vulnerability);
describe('with all the data', () => {
const vulnerability = mockData[0];
let payload;
let state;
beforeEach(() => {
state = createState();
payload = { vulnerability };
mutations[types.SET_MODAL_DATA](state, payload);
});
it('should set the modal title', () => {
expect(state.modal.title).toEqual(vulnerability.name);
});
it('should set the modal description', () => {
expect(state.modal.data.description.value).toEqual(vulnerability.description);
});
it('should set the modal project', () => {
expect(state.modal.data.project.value).toEqual(vulnerability.project.full_name);
expect(state.modal.data.project.url).toEqual(vulnerability.project.full_path);
});
it('should set the modal file', () => {
expect(state.modal.data.file.value).toEqual(vulnerability.location.file);
});
it('should set the modal identifiers', () => {
expect(state.modal.data.identifiers.value).toEqual(vulnerability.identifiers);
});
it('should set the modal severity', () => {
expect(state.modal.data.severity.value).toEqual(vulnerability.severity);
});
it('should set the modal confidence', () => {
expect(state.modal.data.confidence.value).toEqual(vulnerability.confidence);
});
it('should set the modal solution', () => {
expect(state.modal.data.solution.value).toEqual(vulnerability.solution);
});
it('should set the modal links', () => {
expect(state.modal.data.links.value).toEqual(vulnerability.links);
});
it('should set the modal instances', () => {
expect(state.modal.data.instances.value).toEqual(vulnerability.instances);
});
it('should set the modal vulnerability', () => {
expect(state.modal.vulnerability).toEqual(vulnerability);
});
});
describe('with irregular data', () => {
const vulnerability = mockData[0];
let state;
beforeEach(() => {
state = createState();
});
it('should set isDismissed when the vulnerabilitiy is dismissed', () => {
const payload = {
vulnerability: { ...vulnerability, dismissal_feedback: 'I am dismissed' },
};
mutations[types.SET_MODAL_DATA](state, payload);
expect(state.modal.vulnerability.isDismissed).toEqual(true);
});
it('should set hasIssue when the vulnerabilitiy has a related issue', () => {
const payload = { vulnerability: { ...vulnerability, issue_feedback: 'I am an issue' } };
mutations[types.SET_MODAL_DATA](state, payload);
expect(state.modal.vulnerability.hasIssue).toEqual(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