Remove redundant mutations

This removes the following mutations:

* RECEIVE_DELETE_LICENSE_ERROR
* RECEIVE_SET_LICENSE_APPROVAL_ERROR

Both these mutations did the same thing as RESET_LICENSE_IN_MODAL which
can be committed instead.
parent f7c9d1ab
......@@ -32,7 +32,7 @@ export const receiveDeleteLicense = ({ commit, dispatch }, id) => {
});
};
export const receiveDeleteLicenseError = ({ commit }) => {
commit(types.RECEIVE_DELETE_LICENSE_ERROR);
commit(types.RESET_LICENSE_IN_MODAL);
};
export const deleteLicense = ({ dispatch, state }) => {
const licenseId = state.currentLicenseInModal.id;
......@@ -111,7 +111,7 @@ export const receiveSetLicenseApproval = ({ commit, dispatch, state }, id) => {
});
};
export const receiveSetLicenseApprovalError = ({ commit }) => {
commit(types.RECEIVE_SET_LICENSE_APPROVAL_ERROR);
commit(types.RESET_LICENSE_IN_MODAL);
};
export const fetchLicenseCheckApprovalRule = ({ dispatch, state }) => {
......
export const RECEIVE_DELETE_LICENSE = 'RECEIVE_DELETE_LICENSE';
export const RECEIVE_DELETE_LICENSE_ERROR = 'RECEIVE_DELETE_LICENSE_ERROR';
export const RECEIVE_MANAGED_LICENSES_SUCCESS = 'RECEIVE_MANAGED_LICENSES_SUCCESS';
export const RECEIVE_MANAGED_LICENSES_ERROR = 'RECEIVE_MANAGED_LICENSES_ERROR';
export const RECEIVE_PARSED_LICENSE_REPORT_SUCCESS = 'RECEIVE_PARSED_LICENSE_REPORT_SUCCESS';
export const RECEIVE_PARSED_LICENSE_REPORT_ERROR = 'RECEIVE_PARSED_LICENSE_REPORT_ERROR';
export const RECEIVE_SET_LICENSE_APPROVAL = 'RECEIVE_SET_LICENSE_APPROVAL';
export const RECEIVE_SET_LICENSE_APPROVAL_ERROR = 'RECEIVE_SET_LICENSE_APPROVAL_ERROR';
export const REQUEST_MANAGED_LICENSES = 'REQUEST_MANAGED_LICENSES';
export const REQUEST_PARSED_LICENSE_REPORT = 'REQUEST_PARSED_LICENSE_REPORT';
export const RESET_LICENSE_IN_MODAL = 'RESET_LICENSE_IN_MODAL';
......
......@@ -70,21 +70,11 @@ export default {
currentLicenseInModal: null,
});
},
[types.RECEIVE_DELETE_LICENSE_ERROR](state) {
Object.assign(state, {
currentLicenseInModal: null,
});
},
[types.RECEIVE_SET_LICENSE_APPROVAL](state) {
Object.assign(state, {
currentLicenseInModal: null,
});
},
[types.RECEIVE_SET_LICENSE_APPROVAL_ERROR](state) {
Object.assign(state, {
currentLicenseInModal: null,
});
},
[types.REQUEST_LICENSE_CHECK_APPROVAL_RULE](state) {
Object.assign(state, {
isLoadingLicenseCheckApprovalRule: true,
......
......@@ -128,12 +128,12 @@ describe('License store actions', () => {
});
describe('receiveDeleteLicenseError', () => {
it('commits RECEIVE_DELETE_LICENSE_ERROR', (done) => {
it('commits RESET_LICENSE_IN_MODAL', (done) => {
testAction(
actions.receiveDeleteLicenseError,
null,
state,
[{ type: mutationTypes.RECEIVE_DELETE_LICENSE_ERROR }],
[{ type: mutationTypes.RESET_LICENSE_IN_MODAL }],
[],
)
.then(done)
......@@ -203,12 +203,12 @@ describe('License store actions', () => {
});
describe('receiveSetLicenseApprovalError', () => {
it('commits RECEIVE_SET_LICENSE_APPROVAL_ERROR', (done) => {
it('commits RESET_LICENSE_IN_MODAL', (done) => {
testAction(
actions.receiveSetLicenseApprovalError,
null,
state,
[{ type: mutationTypes.RECEIVE_SET_LICENSE_APPROVAL_ERROR }],
[{ type: mutationTypes.RESET_LICENSE_IN_MODAL }],
[],
)
.then(done)
......
......@@ -83,21 +83,6 @@ describe('License store mutations', () => {
});
});
describe('RECEIVE_DELETE_LICENSE_ERROR', () => {
it('closes the modal', () => {
store.replaceState({
...store.state,
licenseManagement: {
currentLicenseInModal: approvedLicense,
},
});
store.commit(`licenseManagement/${types.RECEIVE_DELETE_LICENSE_ERROR}`);
expect(store.state.licenseManagement.currentLicenseInModal).toBeNull();
});
});
describe('RECEIVE_SET_LICENSE_APPROVAL', () => {
it('closes the modal', () => {
store.replaceState({
......@@ -113,21 +98,6 @@ describe('License store mutations', () => {
});
});
describe('RECEIVE_SET_LICENSE_APPROVAL_ERROR', () => {
it('closes the modal', () => {
store.replaceState({
...store.state,
licenseManagement: {
currentLicenseInModal: approvedLicense,
},
});
store.commit(`licenseManagement/${types.RECEIVE_SET_LICENSE_APPROVAL_ERROR}`);
expect(store.state.licenseManagement.currentLicenseInModal).toBeNull();
});
});
describe('REQUEST_LICENSE_CHECK_APPROVAL_RULE', () => {
it('sets isLoadingLicenseCheckApprovalRule to true', () => {
store.replaceState({
......
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