Commit 469e2348 authored by Mark Florian's avatar Mark Florian

Merge branch '32041-deduplicate-state-props' into 'master'

Deduplicate state properties

See merge request gitlab-org/gitlab!26117
parents d7dbf2bf 8d76154d
...@@ -62,7 +62,14 @@ export default { ...@@ -62,7 +62,14 @@ export default {
}, },
}, },
computed: { computed: {
...mapState('vulnerabilities', ['modal', 'pageInfo', 'loadingVulnerabilitiesErrorCode']), ...mapState('vulnerabilities', [
'modal',
'pageInfo',
'loadingVulnerabilitiesErrorCode',
'isCreatingIssue',
'isDismissingVulnerability',
'isCreatingMergeRequest',
]),
...mapGetters('filters', ['activeFilters']), ...mapGetters('filters', ['activeFilters']),
...mapGetters('vulnerabilities', ['loadingVulnerabilitiesFailedWithRecognizedErrorCode']), ...mapGetters('vulnerabilities', ['loadingVulnerabilitiesFailedWithRecognizedErrorCode']),
canCreateIssue() { canCreateIssue() {
...@@ -182,6 +189,9 @@ export default { ...@@ -182,6 +189,9 @@ export default {
:can-create-issue="canCreateIssue" :can-create-issue="canCreateIssue"
:can-create-merge-request="canCreateMergeRequest" :can-create-merge-request="canCreateMergeRequest"
:can-dismiss-vulnerability="canDismissVulnerability" :can-dismiss-vulnerability="canDismissVulnerability"
:is-creating-issue="isCreatingIssue"
:is-dismissing-vulnerability="isDismissingVulnerability"
:is-creating-merge-request="isCreatingMergeRequest"
@addDismissalComment="addDismissalComment({ vulnerability, comment: $event })" @addDismissalComment="addDismissalComment({ vulnerability, comment: $event })"
@editVulnerabilityDismissalComment="openDismissalCommentBox()" @editVulnerabilityDismissalComment="openDismissalCommentBox()"
@showDismissalDeleteButtons="showDismissalDeleteButtons" @showDismissalDeleteButtons="showDismissalDeleteButtons"
......
...@@ -101,7 +101,6 @@ export default { ...@@ -101,7 +101,6 @@ export default {
}, },
[types.REQUEST_CREATE_ISSUE](state) { [types.REQUEST_CREATE_ISSUE](state) {
state.isCreatingIssue = true; state.isCreatingIssue = true;
Vue.set(state.modal, 'isCreatingNewIssue', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_CREATE_ISSUE_SUCCESS](state, payload) { [types.RECEIVE_CREATE_ISSUE_SUCCESS](state, payload) {
...@@ -110,12 +109,10 @@ export default { ...@@ -110,12 +109,10 @@ export default {
}, },
[types.RECEIVE_CREATE_ISSUE_ERROR](state) { [types.RECEIVE_CREATE_ISSUE_ERROR](state) {
state.isCreatingIssue = false; state.isCreatingIssue = false;
Vue.set(state.modal, 'isCreatingNewIssue', false);
Vue.set(state.modal, 'error', __('There was an error creating the issue')); Vue.set(state.modal, 'error', __('There was an error creating the issue'));
}, },
[types.REQUEST_DISMISS_VULNERABILITY](state) { [types.REQUEST_DISMISS_VULNERABILITY](state) {
state.isDismissingVulnerability = true; state.isDismissingVulnerability = true;
Vue.set(state.modal, 'isDismissingVulnerability', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](state, payload) { [types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](state, payload) {
...@@ -124,12 +121,10 @@ export default { ...@@ -124,12 +121,10 @@ export default {
); );
vulnerability.dismissal_feedback = payload.data; vulnerability.dismissal_feedback = payload.data;
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal.vulnerability, 'isDismissed', true); Vue.set(state.modal.vulnerability, 'isDismissed', true);
}, },
[types.RECEIVE_DISMISS_VULNERABILITY_ERROR](state) { [types.RECEIVE_DISMISS_VULNERABILITY_ERROR](state) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set( Vue.set(
state.modal, state.modal,
'error', 'error',
...@@ -167,7 +162,6 @@ export default { ...@@ -167,7 +162,6 @@ export default {
}, },
[types.REQUEST_ADD_DISMISSAL_COMMENT](state) { [types.REQUEST_ADD_DISMISSAL_COMMENT](state) {
state.isDismissingVulnerability = true; state.isDismissingVulnerability = true;
Vue.set(state.modal, 'isDismissingVulnerability', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_ADD_DISMISSAL_COMMENT_SUCCESS](state, payload) { [types.RECEIVE_ADD_DISMISSAL_COMMENT_SUCCESS](state, payload) {
...@@ -177,18 +171,15 @@ export default { ...@@ -177,18 +171,15 @@ export default {
if (vulnerability) { if (vulnerability) {
vulnerability.dismissal_feedback = payload.data; vulnerability.dismissal_feedback = payload.data;
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal.vulnerability, 'isDismissed', true); Vue.set(state.modal.vulnerability, 'isDismissed', true);
} }
}, },
[types.RECEIVE_ADD_DISMISSAL_COMMENT_ERROR](state) { [types.RECEIVE_ADD_DISMISSAL_COMMENT_ERROR](state) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal, 'error', s__('Security Reports|There was an error adding the comment.')); Vue.set(state.modal, 'error', s__('Security Reports|There was an error adding the comment.'));
}, },
[types.REQUEST_DELETE_DISMISSAL_COMMENT](state) { [types.REQUEST_DELETE_DISMISSAL_COMMENT](state) {
state.isDismissingVulnerability = true; state.isDismissingVulnerability = true;
Vue.set(state.modal, 'isDismissingVulnerability', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_DELETE_DISMISSAL_COMMENT_SUCCESS](state, payload) { [types.RECEIVE_DELETE_DISMISSAL_COMMENT_SUCCESS](state, payload) {
...@@ -196,18 +187,15 @@ export default { ...@@ -196,18 +187,15 @@ export default {
if (vulnerability) { if (vulnerability) {
vulnerability.dismissal_feedback = payload.data; vulnerability.dismissal_feedback = payload.data;
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal.vulnerability, 'isDismissed', true); Vue.set(state.modal.vulnerability, 'isDismissed', true);
} }
}, },
[types.RECEIVE_DELETE_DISMISSAL_COMMENT_ERROR](state) { [types.RECEIVE_DELETE_DISMISSAL_COMMENT_ERROR](state) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal, 'error', s__('Security Reports|There was an error deleting the comment.')); Vue.set(state.modal, 'error', s__('Security Reports|There was an error deleting the comment.'));
}, },
[types.REQUEST_REVERT_DISMISSAL](state) { [types.REQUEST_REVERT_DISMISSAL](state) {
state.isDismissingVulnerability = true; state.isDismissingVulnerability = true;
Vue.set(state.modal, 'isDismissingVulnerability', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_REVERT_DISMISSAL_SUCCESS](state, payload) { [types.RECEIVE_REVERT_DISMISSAL_SUCCESS](state, payload) {
...@@ -216,12 +204,10 @@ export default { ...@@ -216,12 +204,10 @@ export default {
); );
vulnerability.dismissal_feedback = null; vulnerability.dismissal_feedback = null;
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal.vulnerability, 'isDismissed', false); Vue.set(state.modal.vulnerability, 'isDismissed', false);
}, },
[types.RECEIVE_REVERT_DISMISSAL_ERROR](state) { [types.RECEIVE_REVERT_DISMISSAL_ERROR](state) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set( Vue.set(
state.modal, state.modal,
'error', 'error',
...@@ -236,7 +222,6 @@ export default { ...@@ -236,7 +222,6 @@ export default {
}, },
[types.REQUEST_CREATE_MERGE_REQUEST](state) { [types.REQUEST_CREATE_MERGE_REQUEST](state) {
state.isCreatingMergeRequest = true; state.isCreatingMergeRequest = true;
Vue.set(state.modal, 'isCreatingMergeRequest', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_CREATE_MERGE_REQUEST_SUCCESS](state, payload) { [types.RECEIVE_CREATE_MERGE_REQUEST_SUCCESS](state, payload) {
...@@ -245,7 +230,7 @@ export default { ...@@ -245,7 +230,7 @@ export default {
}, },
[types.RECEIVE_CREATE_MERGE_REQUEST_ERROR](state) { [types.RECEIVE_CREATE_MERGE_REQUEST_ERROR](state) {
state.isCreatingIssue = false; state.isCreatingIssue = false;
Vue.set(state.modal, 'isCreatingMergeRequest', false); state.isCreatingMergeRequest = false;
Vue.set( Vue.set(
state.modal, state.modal,
'error', 'error',
......
...@@ -21,12 +21,10 @@ export default () => ({ ...@@ -21,12 +21,10 @@ export default () => ({
modal: { modal: {
vulnerability: {}, vulnerability: {},
project: {}, project: {},
isCreatingNewIssue: false,
isCreatingMergeRequest: false,
isDismissingVulnerability: false,
isCommentingOnDismissal: false, isCommentingOnDismissal: false,
isShowingDeleteButtons: false, isShowingDeleteButtons: false,
}, },
isDismissingVulnerability: false,
isDismissingVulnerabilities: false, isDismissingVulnerabilities: false,
selectedVulnerabilities: {}, selectedVulnerabilities: {},
isCreatingIssue: false, isCreatingIssue: false,
......
...@@ -47,6 +47,18 @@ export default { ...@@ -47,6 +47,18 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
isCreatingIssue: {
type: Boolean,
required: true,
},
isDismissingVulnerability: {
type: Boolean,
required: true,
},
isCreatingMergeRequest: {
type: Boolean,
required: true,
},
}, },
data: () => ({ data: () => ({
localDismissalComment: '', localDismissalComment: '',
...@@ -251,6 +263,7 @@ export default { ...@@ -251,6 +263,7 @@ export default {
v-if="modal.isCommentingOnDismissal" v-if="modal.isCommentingOnDismissal"
:is-dismissed="vulnerability.isDismissed" :is-dismissed="vulnerability.isDismissed"
:is-editing-existing-feedback="isEditingExistingFeedback" :is-editing-existing-feedback="isEditingExistingFeedback"
:is-dismissing-vulnerability="isDismissingVulnerability"
@addCommentAndDismiss="addCommentAndDismiss" @addCommentAndDismiss="addCommentAndDismiss"
@addDismissalComment="addDismissalComment" @addDismissalComment="addDismissalComment"
@cancel="$emit('closeDismissalCommentBox')" @cancel="$emit('closeDismissalCommentBox')"
...@@ -266,6 +279,9 @@ export default { ...@@ -266,6 +279,9 @@ export default {
:can-download-patch="canDownloadPatchForThisVulnerability" :can-download-patch="canDownloadPatchForThisVulnerability"
:can-dismiss-vulnerability="canDismissThisVulnerability" :can-dismiss-vulnerability="canDismissThisVulnerability"
:is-dismissed="vulnerability.isDismissed" :is-dismissed="vulnerability.isDismissed"
:is-creating-issue="isCreatingIssue"
:is-dismissing-vulnerability="isDismissingVulnerability"
:is-creating-merge-request="isCreatingMergeRequest"
@createMergeRequest="$emit('createMergeRequest')" @createMergeRequest="$emit('createMergeRequest')"
@createNewIssue="$emit('createNewIssue')" @createNewIssue="$emit('createNewIssue')"
@dismissVulnerability="$emit('dismissVulnerability')" @dismissVulnerability="$emit('dismissVulnerability')"
......
...@@ -48,6 +48,18 @@ export default { ...@@ -48,6 +48,18 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
isCreatingIssue: {
type: Boolean,
required: true,
},
isDismissingVulnerability: {
type: Boolean,
required: true,
},
isCreatingMergeRequest: {
type: Boolean,
required: true,
},
}, },
computed: { computed: {
actionButtons() { actionButtons() {
...@@ -55,13 +67,13 @@ export default { ...@@ -55,13 +67,13 @@ export default {
const issueButton = { const issueButton = {
name: s__('ciReport|Create issue'), name: s__('ciReport|Create issue'),
tagline: s__('ciReport|Investigate this vulnerability by creating an issue'), tagline: s__('ciReport|Investigate this vulnerability by creating an issue'),
isLoading: this.modal.isCreatingNewIssue, isLoading: this.isCreatingIssue,
action: 'createNewIssue', action: 'createNewIssue',
}; };
const MRButton = { const MRButton = {
name: s__('ciReport|Resolve with merge request'), name: s__('ciReport|Resolve with merge request'),
tagline: s__('ciReport|Automatically apply the patch in a new branch'), tagline: s__('ciReport|Automatically apply the patch in a new branch'),
isLoading: this.modal.isCreatingMergeRequest, isLoading: this.isCreatingMergeRequest,
action: 'createMergeRequest', action: 'createMergeRequest',
}; };
const DownloadButton = { const DownloadButton = {
...@@ -96,7 +108,7 @@ export default { ...@@ -96,7 +108,7 @@ export default {
<dismiss-button <dismiss-button
v-if="canDismissVulnerability" v-if="canDismissVulnerability"
:is-dismissing="modal.isDismissingVulnerability" :is-dismissing="isDismissingVulnerability"
:is-dismissed="isDismissed" :is-dismissed="isDismissed"
:disabled="disabled" :disabled="disabled"
@dismissVulnerability="$emit('dismissVulnerability')" @dismissVulnerability="$emit('dismissVulnerability')"
......
...@@ -134,6 +134,9 @@ export default { ...@@ -134,6 +134,9 @@ export default {
'dependencyScanning', 'dependencyScanning',
'summaryCounts', 'summaryCounts',
'modal', 'modal',
'isCreatingIssue',
'isDismissingVulnerability',
'isCreatingMergeRequest',
]), ]),
...mapGetters([ ...mapGetters([
'groupedSummaryText', 'groupedSummaryText',
...@@ -391,6 +394,9 @@ export default { ...@@ -391,6 +394,9 @@ export default {
:can-create-issue="canCreateIssue" :can-create-issue="canCreateIssue"
:can-create-merge-request="canCreateMergeRequest" :can-create-merge-request="canCreateMergeRequest"
:can-dismiss-vulnerability="canDismissVulnerability" :can-dismiss-vulnerability="canDismissVulnerability"
:is-creating-issue="isCreatingIssue"
:is-dismissing-vulnerability="isDismissingVulnerability"
:is-creating-merge-request="isCreatingMergeRequest"
@closeDismissalCommentBox="closeDismissalCommentBox()" @closeDismissalCommentBox="closeDismissalCommentBox()"
@createMergeRequest="createMergeRequest" @createMergeRequest="createMergeRequest"
@createNewIssue="createNewIssue" @createNewIssue="createNewIssue"
......
...@@ -135,52 +135,46 @@ export default { ...@@ -135,52 +135,46 @@ export default {
}, },
[types.REQUEST_DISMISS_VULNERABILITY](state) { [types.REQUEST_DISMISS_VULNERABILITY](state) {
Vue.set(state.modal, 'isDismissingVulnerability', true); state.isDismissingVulnerability = true;
// reset error in case previous state was error // reset error in case previous state was error
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](state) { [types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](state) {
Vue.set(state.modal, 'isDismissingVulnerability', false); state.isDismissingVulnerability = false;
}, },
[types.RECEIVE_DISMISS_VULNERABILITY_ERROR](state, error) { [types.RECEIVE_DISMISS_VULNERABILITY_ERROR](state, error) {
Vue.set(state.modal, 'error', error); Vue.set(state.modal, 'error', error);
Vue.set(state.modal, 'isDismissingVulnerability', false); state.isDismissingVulnerability = false;
}, },
[types.REQUEST_ADD_DISMISSAL_COMMENT](state) { [types.REQUEST_ADD_DISMISSAL_COMMENT](state) {
state.isDismissingVulnerability = true; state.isDismissingVulnerability = true;
Vue.set(state.modal, 'isDismissingVulnerability', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_ADD_DISMISSAL_COMMENT_SUCCESS](state, payload) { [types.RECEIVE_ADD_DISMISSAL_COMMENT_SUCCESS](state, payload) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal.vulnerability, 'isDismissed', true); Vue.set(state.modal.vulnerability, 'isDismissed', true);
Vue.set(state.modal.vulnerability, 'dismissalFeedback', payload.data); Vue.set(state.modal.vulnerability, 'dismissalFeedback', payload.data);
}, },
[types.RECEIVE_ADD_DISMISSAL_COMMENT_ERROR](state, error) { [types.RECEIVE_ADD_DISMISSAL_COMMENT_ERROR](state, error) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal, 'error', error); Vue.set(state.modal, 'error', error);
}, },
[types.REQUEST_DELETE_DISMISSAL_COMMENT](state) { [types.REQUEST_DELETE_DISMISSAL_COMMENT](state) {
state.isDismissingVulnerability = true; state.isDismissingVulnerability = true;
Vue.set(state.modal, 'isDismissingVulnerability', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_DELETE_DISMISSAL_COMMENT_SUCCESS](state, payload) { [types.RECEIVE_DELETE_DISMISSAL_COMMENT_SUCCESS](state, payload) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal.vulnerability, 'isDismissed', true); Vue.set(state.modal.vulnerability, 'isDismissed', true);
Vue.set(state.modal.vulnerability, 'dismissalFeedback', payload.data); Vue.set(state.modal.vulnerability, 'dismissalFeedback', payload.data);
}, },
[types.RECEIVE_DELETE_DISMISSAL_COMMENT_ERROR](state, error) { [types.RECEIVE_DELETE_DISMISSAL_COMMENT_ERROR](state, error) {
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
Vue.set(state.modal, 'isDismissingVulnerability', false);
Vue.set(state.modal, 'error', error); Vue.set(state.modal, 'error', error);
}, },
[types.SHOW_DISMISSAL_DELETE_BUTTONS](state) { [types.SHOW_DISMISSAL_DELETE_BUTTONS](state) {
...@@ -241,23 +235,22 @@ export default { ...@@ -241,23 +235,22 @@ export default {
}, },
[types.REQUEST_CREATE_ISSUE](state) { [types.REQUEST_CREATE_ISSUE](state) {
Vue.set(state.modal, 'isCreatingNewIssue', true); state.isCreatingIssue = true;
// reset error in case previous state was error // reset error in case previous state was error
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_CREATE_ISSUE_SUCCESS](state) { [types.RECEIVE_CREATE_ISSUE_SUCCESS](state) {
Vue.set(state.modal, 'isCreatingNewIssue', false); state.isCreatingIssue = false;
}, },
[types.RECEIVE_CREATE_ISSUE_ERROR](state, error) { [types.RECEIVE_CREATE_ISSUE_ERROR](state, error) {
Vue.set(state.modal, 'error', error); Vue.set(state.modal, 'error', error);
Vue.set(state.modal, 'isCreatingNewIssue', false); state.isCreatingIssue = false;
}, },
[types.REQUEST_CREATE_MERGE_REQUEST](state) { [types.REQUEST_CREATE_MERGE_REQUEST](state) {
state.isCreatingMergeRequest = true; state.isCreatingMergeRequest = true;
Vue.set(state.modal, 'isCreatingMergeRequest', true);
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_CREATE_MERGE_REQUEST_SUCCESS](state, payload) { [types.RECEIVE_CREATE_MERGE_REQUEST_SUCCESS](state, payload) {
...@@ -266,7 +259,6 @@ export default { ...@@ -266,7 +259,6 @@ export default {
}, },
[types.RECEIVE_CREATE_MERGE_REQUEST_ERROR](state, error) { [types.RECEIVE_CREATE_MERGE_REQUEST_ERROR](state, error) {
state.isCreatingMergeRequest = false; state.isCreatingMergeRequest = false;
Vue.set(state.modal, 'isCreatingMergeRequest', false);
Vue.set(state.modal, 'error', error); Vue.set(state.modal, 'error', error);
}, },
[types.OPEN_DISMISSAL_COMMENT_BOX](state) { [types.OPEN_DISMISSAL_COMMENT_BOX](state) {
......
...@@ -71,10 +71,12 @@ export default () => ({ ...@@ -71,10 +71,12 @@ export default () => ({
hasMergeRequest: false, hasMergeRequest: false,
}, },
isCreatingNewIssue: false,
isDismissingVulnerability: false,
isShowingDeleteButtons: false, isShowingDeleteButtons: false,
isCommentingOnDismissal: false, isCommentingOnDismissal: false,
error: null, error: null,
}, },
isCreatingIssue: false,
isDismissingVulnerability: false,
isCreatingMergeRequest: false,
}); });
...@@ -8,8 +8,15 @@ import LoadingButton from '~/vue_shared/components/loading_button.vue'; ...@@ -8,8 +8,15 @@ import LoadingButton from '~/vue_shared/components/loading_button.vue';
describe('Security Reports modal footer', () => { describe('Security Reports modal footer', () => {
let wrapper; let wrapper;
const mountComponent = options => { const mountComponent = propsData => {
wrapper = mount(component, options); wrapper = mount(component, {
propsData: {
isCreatingIssue: false,
isDismissingVulnerability: false,
isCreatingMergeRequest: false,
...propsData,
},
});
}; };
describe('can only create issue', () => { describe('can only create issue', () => {
...@@ -18,7 +25,7 @@ describe('Security Reports modal footer', () => { ...@@ -18,7 +25,7 @@ describe('Security Reports modal footer', () => {
modal: createState().modal, modal: createState().modal,
canCreateIssue: true, canCreateIssue: true,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('does not render dismiss button', () => { it('does not render dismiss button', () => {
...@@ -45,7 +52,7 @@ describe('Security Reports modal footer', () => { ...@@ -45,7 +52,7 @@ describe('Security Reports modal footer', () => {
modal: createState().modal, modal: createState().modal,
canCreateMergeRequest: true, canCreateMergeRequest: true,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('only renders the create merge request button', () => { it('only renders the create merge request button', () => {
...@@ -68,7 +75,7 @@ describe('Security Reports modal footer', () => { ...@@ -68,7 +75,7 @@ describe('Security Reports modal footer', () => {
modal: createState().modal, modal: createState().modal,
canDownloadPatch: true, canDownloadPatch: true,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('renders the download patch button', () => { it('renders the download patch button', () => {
...@@ -92,7 +99,7 @@ describe('Security Reports modal footer', () => { ...@@ -92,7 +99,7 @@ describe('Security Reports modal footer', () => {
canCreateIssue: true, canCreateIssue: true,
canCreateMergeRequest: true, canCreateMergeRequest: true,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('renders create merge request and issue button as a split button', () => { it('renders create merge request and issue button as a split button', () => {
...@@ -112,7 +119,7 @@ describe('Security Reports modal footer', () => { ...@@ -112,7 +119,7 @@ describe('Security Reports modal footer', () => {
canCreateMergeRequest: true, canCreateMergeRequest: true,
canDownloadPatch: true, canDownloadPatch: true,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('renders the split button', () => { it('renders the split button', () => {
...@@ -130,7 +137,7 @@ describe('Security Reports modal footer', () => { ...@@ -130,7 +137,7 @@ describe('Security Reports modal footer', () => {
modal: createState().modal, modal: createState().modal,
canDismissVulnerability: true, canDismissVulnerability: true,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('should render the dismiss button', () => { it('should render the dismiss button', () => {
......
...@@ -7,8 +7,15 @@ import { mount, shallowMount } from '@vue/test-utils'; ...@@ -7,8 +7,15 @@ import { mount, shallowMount } from '@vue/test-utils';
describe('Security Reports modal', () => { describe('Security Reports modal', () => {
let wrapper; let wrapper;
const mountComponent = (options, mountFn = shallowMount) => { const mountComponent = (propsData, mountFn = shallowMount) => {
wrapper = mountFn(component, options); wrapper = mountFn(component, {
propsData: {
isCreatingIssue: false,
isDismissingVulnerability: false,
isCreatingMergeRequest: false,
...propsData,
},
});
}; };
describe('with permissions', () => { describe('with permissions', () => {
...@@ -24,7 +31,7 @@ describe('Security Reports modal', () => { ...@@ -24,7 +31,7 @@ describe('Security Reports modal', () => {
pipeline: { id: '123', path: '#' }, pipeline: { id: '123', path: '#' },
created_at: new Date().toString(), created_at: new Date().toString(),
}; };
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
}); });
it('renders dismissal author and associated pipeline', () => { it('renders dismissal author and associated pipeline', () => {
...@@ -48,7 +55,7 @@ describe('Security Reports modal', () => { ...@@ -48,7 +55,7 @@ describe('Security Reports modal', () => {
author: { username: 'jsmith', name: 'John Smith' }, author: { username: 'jsmith', name: 'John Smith' },
pipeline: { id: '123', path: '#' }, pipeline: { id: '123', path: '#' },
}; };
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
}); });
it('renders dismissal author and hides associated pipeline', () => { it('renders dismissal author and hides associated pipeline', () => {
...@@ -64,7 +71,7 @@ describe('Security Reports modal', () => { ...@@ -64,7 +71,7 @@ describe('Security Reports modal', () => {
modal: createState().modal, modal: createState().modal,
canDismissVulnerability: true, canDismissVulnerability: true,
}; };
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
}); });
it('allows the vulnerability to be dismissed', () => { it('allows the vulnerability to be dismissed', () => {
...@@ -82,7 +89,7 @@ describe('Security Reports modal', () => { ...@@ -82,7 +89,7 @@ describe('Security Reports modal', () => {
const summary = 'Upgrade to 123'; const summary = 'Upgrade to 123';
const diff = 'abc123'; const diff = 'abc123';
propsData.modal.vulnerability.remediations = [{ summary, diff }]; propsData.modal.vulnerability.remediations = [{ summary, diff }];
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
}); });
it('renders create merge request and issue button as a split button', () => { it('renders create merge request and issue button as a split button', () => {
...@@ -125,7 +132,7 @@ describe('Security Reports modal', () => { ...@@ -125,7 +132,7 @@ describe('Security Reports modal', () => {
vulnerabilityFeedbackHelpPath: 'feedbacksHelpPath', vulnerabilityFeedbackHelpPath: 'feedbacksHelpPath',
}; };
propsData.modal.title = 'Arbitrary file existence disclosure in Action Pack'; propsData.modal.title = 'Arbitrary file existence disclosure in Action Pack';
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
}); });
it('renders title', () => { it('renders title', () => {
...@@ -149,7 +156,7 @@ describe('Security Reports modal', () => { ...@@ -149,7 +156,7 @@ describe('Security Reports modal', () => {
}; };
propsData.modal.vulnerability.remediations = [{ diff: '123' }]; propsData.modal.vulnerability.remediations = [{ diff: '123' }];
propsData.modal.isResolved = true; propsData.modal.isResolved = true;
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('disallows any actions in the footer', () => { it('disallows any actions in the footer', () => {
...@@ -168,7 +175,7 @@ describe('Security Reports modal', () => { ...@@ -168,7 +175,7 @@ describe('Security Reports modal', () => {
const propsData = { const propsData = {
modal: createState().modal, modal: createState().modal,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('disallows any actions in the footer', () => { it('disallows any actions in the footer', () => {
...@@ -191,7 +198,7 @@ describe('Security Reports modal', () => { ...@@ -191,7 +198,7 @@ describe('Security Reports modal', () => {
propsData.modal.vulnerability.issue_feedback = { propsData.modal.vulnerability.issue_feedback = {
issue_url: 'http://issue.url', issue_url: 'http://issue.url',
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('displays a link to the issue', () => { it('displays a link to the issue', () => {
...@@ -209,7 +216,7 @@ describe('Security Reports modal', () => { ...@@ -209,7 +216,7 @@ describe('Security Reports modal', () => {
propsData.modal.vulnerability.issue_feedback = { propsData.modal.vulnerability.issue_feedback = {
issue_url: null, issue_url: null,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('hides the link to the issue', () => { it('hides the link to the issue', () => {
...@@ -229,7 +236,7 @@ describe('Security Reports modal', () => { ...@@ -229,7 +236,7 @@ describe('Security Reports modal', () => {
propsData.modal.vulnerability.merge_request_feedback = { propsData.modal.vulnerability.merge_request_feedback = {
merge_request_path: 'http://mr.url', merge_request_path: 'http://mr.url',
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('displays a link to the merge request', () => { it('displays a link to the merge request', () => {
...@@ -247,7 +254,7 @@ describe('Security Reports modal', () => { ...@@ -247,7 +254,7 @@ describe('Security Reports modal', () => {
propsData.modal.vulnerability.merge_request_feedback = { propsData.modal.vulnerability.merge_request_feedback = {
merge_request_path: null, merge_request_path: null,
}; };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('hides the link to the merge request', () => { it('hides the link to the merge request', () => {
...@@ -263,7 +270,7 @@ describe('Security Reports modal', () => { ...@@ -263,7 +270,7 @@ describe('Security Reports modal', () => {
modal: createState().modal, modal: createState().modal,
}; };
propsData.modal.isResolved = true; propsData.modal.isResolved = true;
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('disallows any actions in the footer', () => { it('disallows any actions in the footer', () => {
...@@ -290,7 +297,7 @@ describe('Security Reports modal', () => { ...@@ -290,7 +297,7 @@ describe('Security Reports modal', () => {
file: fileValue, file: fileValue,
operating_system: namespaceValue, operating_system: namespaceValue,
}; };
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
}); });
it('is rendered', () => { it('is rendered', () => {
...@@ -310,7 +317,7 @@ describe('Security Reports modal', () => { ...@@ -310,7 +317,7 @@ describe('Security Reports modal', () => {
const solution = 'Upgrade to XYZ'; const solution = 'Upgrade to XYZ';
propsData.modal.vulnerability.solution = solution; propsData.modal.vulnerability.solution = solution;
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
const solutionCard = wrapper.find(SolutionCard); const solutionCard = wrapper.find(SolutionCard);
...@@ -326,7 +333,7 @@ describe('Security Reports modal', () => { ...@@ -326,7 +333,7 @@ describe('Security Reports modal', () => {
const summary = 'Upgrade to 123'; const summary = 'Upgrade to 123';
const diff = 'foo'; const diff = 'foo';
propsData.modal.vulnerability.remediations = [{ summary, diff }]; propsData.modal.vulnerability.remediations = [{ summary, diff }];
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
const solutionCard = wrapper.find(SolutionCard); const solutionCard = wrapper.find(SolutionCard);
...@@ -340,7 +347,7 @@ describe('Security Reports modal', () => { ...@@ -340,7 +347,7 @@ describe('Security Reports modal', () => {
const propsData = { const propsData = {
modal: createState().modal, modal: createState().modal,
}; };
mountComponent({ propsData }, mount); mountComponent(propsData, mount);
const solutionCard = wrapper.find(SolutionCard); const solutionCard = wrapper.find(SolutionCard);
...@@ -372,7 +379,7 @@ describe('Security Reports modal', () => { ...@@ -372,7 +379,7 @@ describe('Security Reports modal', () => {
describe('with a non-dismissed vulnerability', () => { describe('with a non-dismissed vulnerability', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('creates an error when an empty comment is submitted', () => { it('creates an error when an empty comment is submitted', () => {
...@@ -396,7 +403,7 @@ describe('Security Reports modal', () => { ...@@ -396,7 +403,7 @@ describe('Security Reports modal', () => {
describe('with a dismissed vulnerability', () => { describe('with a dismissed vulnerability', () => {
beforeEach(() => { beforeEach(() => {
propsData.modal.vulnerability.dismissal_feedback = { author: {} }; propsData.modal.vulnerability.dismissal_feedback = { author: {} };
mountComponent({ propsData }); mountComponent(propsData);
}); });
it('creates an error when an empty comment is submitted', () => { it('creates an error when an empty comment is submitted', () => {
......
...@@ -84,8 +84,7 @@ describe('security reports mutations', () => { ...@@ -84,8 +84,7 @@ describe('security reports mutations', () => {
expect(stateCopy.modal.vulnerability.isDismissed).toEqual(false); expect(stateCopy.modal.vulnerability.isDismissed).toEqual(false);
expect(stateCopy.modal.vulnerability.hasIssue).toEqual(false); expect(stateCopy.modal.vulnerability.hasIssue).toEqual(false);
expect(stateCopy.modal.isCreatingNewIssue).toEqual(false); expect(stateCopy.isDismissingVulnerability).toEqual(false);
expect(stateCopy.modal.isDismissingVulnerability).toEqual(false);
expect(stateCopy.modal.title).toEqual(null); expect(stateCopy.modal.title).toEqual(null);
expect(stateCopy.modal.learnMoreUrl).toEqual(null); expect(stateCopy.modal.learnMoreUrl).toEqual(null);
...@@ -148,7 +147,7 @@ describe('security reports mutations', () => { ...@@ -148,7 +147,7 @@ describe('security reports mutations', () => {
it('sets isDismissingVulnerability prop to true and resets error', () => { it('sets isDismissingVulnerability prop to true and resets error', () => {
mutations[types.REQUEST_DISMISS_VULNERABILITY](stateCopy); mutations[types.REQUEST_DISMISS_VULNERABILITY](stateCopy);
expect(stateCopy.modal.isDismissingVulnerability).toEqual(true); expect(stateCopy.isDismissingVulnerability).toEqual(true);
expect(stateCopy.modal.error).toBeNull(); expect(stateCopy.modal.error).toBeNull();
}); });
}); });
...@@ -157,7 +156,7 @@ describe('security reports mutations', () => { ...@@ -157,7 +156,7 @@ describe('security reports mutations', () => {
it('sets isDismissingVulnerability prop to false', () => { it('sets isDismissingVulnerability prop to false', () => {
mutations[types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](stateCopy); mutations[types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](stateCopy);
expect(stateCopy.modal.isDismissingVulnerability).toEqual(false); expect(stateCopy.isDismissingVulnerability).toEqual(false);
}); });
}); });
...@@ -165,7 +164,7 @@ describe('security reports mutations', () => { ...@@ -165,7 +164,7 @@ describe('security reports mutations', () => {
it('sets isDismissingVulnerability prop to false and sets error', () => { it('sets isDismissingVulnerability prop to false and sets error', () => {
mutations[types.RECEIVE_DISMISS_VULNERABILITY_ERROR](stateCopy, 'error'); mutations[types.RECEIVE_DISMISS_VULNERABILITY_ERROR](stateCopy, 'error');
expect(stateCopy.modal.isDismissingVulnerability).toEqual(false); expect(stateCopy.isDismissingVulnerability).toEqual(false);
expect(stateCopy.modal.error).toEqual('error'); expect(stateCopy.modal.error).toEqual('error');
}); });
}); });
...@@ -179,10 +178,6 @@ describe('security reports mutations', () => { ...@@ -179,10 +178,6 @@ describe('security reports mutations', () => {
expect(stateCopy.isDismissingVulnerability).toBe(true); expect(stateCopy.isDismissingVulnerability).toBe(true);
}); });
it('should set isDismissingVulnerability in the modal data to true', () => {
expect(stateCopy.modal.isDismissingVulnerability).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(stateCopy.modal.error).toBeNull(); expect(stateCopy.modal.error).toBeNull();
}); });
...@@ -204,11 +199,7 @@ describe('security reports mutations', () => { ...@@ -204,11 +199,7 @@ describe('security reports mutations', () => {
expect(stateCopy.isDismissingVulnerability).toBe(false); expect(stateCopy.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability on the modal to false', () => { it('should set isDismissed on the modal vulnerability to be true', () => {
expect(stateCopy.modal.isDismissingVulnerability).toBe(false);
});
it('shoulfd set isDissmissed on the modal vulnerability to be true', () => {
expect(stateCopy.modal.vulnerability.isDismissed).toBe(true); expect(stateCopy.modal.vulnerability.isDismissed).toBe(true);
}); });
}); });
...@@ -224,10 +215,6 @@ describe('security reports mutations', () => { ...@@ -224,10 +215,6 @@ describe('security reports mutations', () => {
expect(stateCopy.isDismissingVulnerability).toBe(false); expect(stateCopy.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability in the modal data to false', () => {
expect(stateCopy.modal.isDismissingVulnerability).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(stateCopy.modal.error).toEqual(error); expect(stateCopy.modal.error).toEqual(error);
}); });
...@@ -242,10 +229,6 @@ describe('security reports mutations', () => { ...@@ -242,10 +229,6 @@ describe('security reports mutations', () => {
expect(stateCopy.isDismissingVulnerability).toBe(true); expect(stateCopy.isDismissingVulnerability).toBe(true);
}); });
it('should set isDismissingVulnerability in the modal data to true', () => {
expect(stateCopy.modal.isDismissingVulnerability).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(stateCopy.modal.error).toBeNull(); expect(stateCopy.modal.error).toBeNull();
}); });
...@@ -267,11 +250,7 @@ describe('security reports mutations', () => { ...@@ -267,11 +250,7 @@ describe('security reports mutations', () => {
expect(stateCopy.isDismissingVulnerability).toBe(false); expect(stateCopy.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability on the modal to false', () => { it('should set isDismissed on the modal vulnerability to be true', () => {
expect(stateCopy.modal.isDismissingVulnerability).toBe(false);
});
it('shoulfd set isDissmissed on the modal vulnerability to be true', () => {
expect(stateCopy.modal.vulnerability.isDismissed).toBe(true); expect(stateCopy.modal.vulnerability.isDismissed).toBe(true);
}); });
}); });
...@@ -287,10 +266,6 @@ describe('security reports mutations', () => { ...@@ -287,10 +266,6 @@ describe('security reports mutations', () => {
expect(stateCopy.isDismissingVulnerability).toBe(false); expect(stateCopy.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability in the modal data to false', () => {
expect(stateCopy.modal.isDismissingVulnerability).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(stateCopy.modal.error).toEqual(error); expect(stateCopy.modal.error).toEqual(error);
}); });
...@@ -341,27 +316,27 @@ describe('security reports mutations', () => { ...@@ -341,27 +316,27 @@ describe('security reports mutations', () => {
}); });
describe('REQUEST_CREATE_ISSUE', () => { describe('REQUEST_CREATE_ISSUE', () => {
it('sets isCreatingNewIssue prop to true and resets error', () => { it('sets isCreatingIssue prop to true and resets error', () => {
mutations[types.REQUEST_CREATE_ISSUE](stateCopy); mutations[types.REQUEST_CREATE_ISSUE](stateCopy);
expect(stateCopy.modal.isCreatingNewIssue).toEqual(true); expect(stateCopy.isCreatingIssue).toEqual(true);
expect(stateCopy.modal.error).toBeNull(); expect(stateCopy.modal.error).toBeNull();
}); });
}); });
describe('RECEIVE_CREATE_ISSUE_SUCCESS', () => { describe('RECEIVE_CREATE_ISSUE_SUCCESS', () => {
it('sets isCreatingNewIssue prop to false', () => { it('sets isCreatingIssue prop to false', () => {
mutations[types.RECEIVE_CREATE_ISSUE_SUCCESS](stateCopy); mutations[types.RECEIVE_CREATE_ISSUE_SUCCESS](stateCopy);
expect(stateCopy.modal.isCreatingNewIssue).toEqual(false); expect(stateCopy.isCreatingIssue).toEqual(false);
}); });
}); });
describe('RECEIVE_CREATE_ISSUE_ERROR', () => { describe('RECEIVE_CREATE_ISSUE_ERROR', () => {
it('sets isCreatingNewIssue prop to false and sets error', () => { it('sets isCreatingIssue prop to false and sets error', () => {
mutations[types.RECEIVE_CREATE_ISSUE_ERROR](stateCopy, 'error'); mutations[types.RECEIVE_CREATE_ISSUE_ERROR](stateCopy, 'error');
expect(stateCopy.modal.isCreatingNewIssue).toEqual(false); expect(stateCopy.isCreatingIssue).toEqual(false);
expect(stateCopy.modal.error).toEqual('error'); expect(stateCopy.modal.error).toEqual('error');
}); });
}); });
...@@ -370,7 +345,7 @@ describe('security reports mutations', () => { ...@@ -370,7 +345,7 @@ describe('security reports mutations', () => {
it('sets isCreatingMergeRequest prop to true and resets error', () => { it('sets isCreatingMergeRequest prop to true and resets error', () => {
mutations[types.REQUEST_CREATE_MERGE_REQUEST](stateCopy); mutations[types.REQUEST_CREATE_MERGE_REQUEST](stateCopy);
expect(stateCopy.modal.isCreatingMergeRequest).toEqual(true); expect(stateCopy.isCreatingMergeRequest).toEqual(true);
expect(stateCopy.modal.error).toBeNull(); expect(stateCopy.modal.error).toBeNull();
}); });
}); });
...@@ -388,7 +363,7 @@ describe('security reports mutations', () => { ...@@ -388,7 +363,7 @@ describe('security reports mutations', () => {
it('sets isCreatingMergeRequest prop to false and sets error', () => { it('sets isCreatingMergeRequest prop to false and sets error', () => {
mutations[types.RECEIVE_CREATE_MERGE_REQUEST_ERROR](stateCopy, 'error'); mutations[types.RECEIVE_CREATE_MERGE_REQUEST_ERROR](stateCopy, 'error');
expect(stateCopy.modal.isCreatingMergeRequest).toEqual(false); expect(stateCopy.isCreatingMergeRequest).toEqual(false);
expect(stateCopy.modal.error).toEqual('error'); expect(stateCopy.modal.error).toEqual('error');
}); });
}); });
......
...@@ -304,10 +304,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -304,10 +304,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isCreatingIssue).toBe(true); expect(state.isCreatingIssue).toBe(true);
}); });
it('should set isCreatingNewIssue in the modal data to true', () => {
expect(state.modal.isCreatingNewIssue).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(state.modal.error).toBeNull(); expect(state.modal.error).toBeNull();
}); });
...@@ -332,10 +328,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -332,10 +328,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isCreatingIssue).toBe(false); expect(state.isCreatingIssue).toBe(false);
}); });
it('should set isCreatingNewIssue in the modal data to false', () => {
expect(state.modal.isCreatingNewIssue).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(state.modal.error).toBe('There was an error creating the issue'); expect(state.modal.error).toBe('There was an error creating the issue');
}); });
...@@ -350,10 +342,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -350,10 +342,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isCreatingMergeRequest).toBe(true); expect(state.isCreatingMergeRequest).toBe(true);
}); });
it('should set isCreatingMergeRequest in the modal data to true', () => {
expect(state.modal.isCreatingMergeRequest).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(state.modal.error).toBeNull(); expect(state.modal.error).toBeNull();
}); });
...@@ -378,10 +366,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -378,10 +366,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isCreatingMergeRequest).toBe(false); expect(state.isCreatingMergeRequest).toBe(false);
}); });
it('should set isCreatingMergeRequest in the modal data to false', () => {
expect(state.modal.isCreatingMergeRequest).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(state.modal.error).toBe('There was an error creating the merge request'); expect(state.modal.error).toBe('There was an error creating the merge request');
}); });
...@@ -396,10 +380,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -396,10 +380,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(true); expect(state.isDismissingVulnerability).toBe(true);
}); });
it('should set isDismissingVulnerability in the modal data to true', () => {
expect(state.modal.isDismissingVulnerability).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(state.modal.error).toBeNull(); expect(state.modal.error).toBeNull();
}); });
...@@ -426,11 +406,7 @@ describe('vulnerabilities module mutations', () => { ...@@ -426,11 +406,7 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability on the modal to false', () => { it('should set isDismissed on the modal vulnerability to be true', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('shoulfd set isDissmissed on the modal vulnerability to be true', () => {
expect(state.modal.vulnerability.isDismissed).toBe(true); expect(state.modal.vulnerability.isDismissed).toBe(true);
}); });
}); });
...@@ -444,10 +420,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -444,10 +420,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability in the modal data to false', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(state.modal.error).toBe('There was an error dismissing the vulnerability.'); expect(state.modal.error).toBe('There was an error dismissing the vulnerability.');
}); });
...@@ -561,10 +533,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -561,10 +533,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(true); expect(state.isDismissingVulnerability).toBe(true);
}); });
it('should set isDismissingVulnerability in the modal data to true', () => {
expect(state.modal.isDismissingVulnerability).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(state.modal.error).toBeNull(); expect(state.modal.error).toBeNull();
}); });
...@@ -591,10 +559,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -591,10 +559,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability on the modal to false', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('should set isDissmissed on the modal vulnerability to be true', () => { it('should set isDissmissed on the modal vulnerability to be true', () => {
expect(state.modal.vulnerability.isDismissed).toBe(true); expect(state.modal.vulnerability.isDismissed).toBe(true);
}); });
...@@ -609,10 +573,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -609,10 +573,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability in the modal data to false', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(state.modal.error).toBe('There was an error deleting the comment.'); expect(state.modal.error).toBe('There was an error deleting the comment.');
}); });
...@@ -647,10 +607,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -647,10 +607,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(true); expect(state.isDismissingVulnerability).toBe(true);
}); });
it('should set isDismissingVulnerability in the modal data to true', () => {
expect(state.modal.isDismissingVulnerability).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(state.modal.error).toBeNull(); expect(state.modal.error).toBeNull();
}); });
...@@ -677,10 +633,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -677,10 +633,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability on the modal to false', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('should set isDissmissed on the modal vulnerability to be true', () => { it('should set isDissmissed on the modal vulnerability to be true', () => {
expect(state.modal.vulnerability.isDismissed).toBe(true); expect(state.modal.vulnerability.isDismissed).toBe(true);
}); });
...@@ -695,10 +647,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -695,10 +647,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability in the modal data to false', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(state.modal.error).toBe('There was an error adding the comment.'); expect(state.modal.error).toBe('There was an error adding the comment.');
}); });
...@@ -713,10 +661,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -713,10 +661,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(true); expect(state.isDismissingVulnerability).toBe(true);
}); });
it('should set isDismissingVulnerability in the modal data to true', () => {
expect(state.modal.isDismissingVulnerability).toBe(true);
});
it('should nullify the error state on the modal', () => { it('should nullify the error state on the modal', () => {
expect(state.modal.error).toBeNull(); expect(state.modal.error).toBeNull();
}); });
...@@ -741,10 +685,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -741,10 +685,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability on the modal to false', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('should set isDissmissed on the modal vulnerability to be false', () => { it('should set isDissmissed on the modal vulnerability to be false', () => {
expect(state.modal.vulnerability.isDismissed).toBe(false); expect(state.modal.vulnerability.isDismissed).toBe(false);
}); });
...@@ -759,10 +699,6 @@ describe('vulnerabilities module mutations', () => { ...@@ -759,10 +699,6 @@ describe('vulnerabilities module mutations', () => {
expect(state.isDismissingVulnerability).toBe(false); expect(state.isDismissingVulnerability).toBe(false);
}); });
it('should set isDismissingVulnerability in the modal data to false', () => {
expect(state.modal.isDismissingVulnerability).toBe(false);
});
it('should set the error state on the modal', () => { it('should set the error state on the modal', () => {
expect(state.modal.error).toBe('There was an error reverting the dismissal.'); expect(state.modal.error).toBe('There was an error reverting the dismissal.');
}); });
......
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