Commit a51a23e4 authored by Sam Beckham's avatar Sam Beckham Committed by Phil Hughes

Triggers the correct endpoint on licence removal

Previously we were requesting the data from the old endpoint on license
approval regardles of the feature flag state. This rectifies that
situation.
parent 5eb29e23
---
title: Triggers the correct endpoint on licence approval
merge_request: 19078
author:
type: fixed
...@@ -131,7 +131,11 @@ export const requestSetLicenseApproval = ({ commit }) => { ...@@ -131,7 +131,11 @@ export const requestSetLicenseApproval = ({ commit }) => {
}; };
export const receiveSetLicenseApproval = ({ commit, dispatch }) => { export const receiveSetLicenseApproval = ({ commit, dispatch }) => {
commit(types.RECEIVE_SET_LICENSE_APPROVAL); commit(types.RECEIVE_SET_LICENSE_APPROVAL);
dispatch('loadManagedLicenses'); if (gon.features && gon.features.parsedLicenseReport) {
dispatch('loadParsedLicenseReport');
} else {
dispatch('loadManagedLicenses');
}
}; };
export const receiveSetLicenseApprovalError = ({ commit }, error) => { export const receiveSetLicenseApprovalError = ({ commit }, error) => {
commit(types.RECEIVE_SET_LICENSE_APPROVAL_ERROR, error); commit(types.RECEIVE_SET_LICENSE_APPROVAL_ERROR, error);
......
...@@ -186,16 +186,47 @@ describe('License store actions', () => { ...@@ -186,16 +186,47 @@ describe('License store actions', () => {
}); });
describe('receiveSetLicenseApproval', () => { describe('receiveSetLicenseApproval', () => {
it('commits RECEIVE_SET_LICENSE_APPROVAL and dispatches loadManagedLicenses', done => { gon.features = gon.features || {};
testAction( const { parsedLicenseReport } = gon.features;
actions.receiveSetLicenseApproval,
null, afterEach(() => {
state, gon.features.parsedLicenseReport = parsedLicenseReport;
[{ type: mutationTypes.RECEIVE_SET_LICENSE_APPROVAL }], });
[{ type: 'loadManagedLicenses' }],
) describe('with the parsedLicenseReport feature flag enabled', () => {
.then(done) beforeEach(() => {
.catch(done.fail); gon.features.parsedLicenseReport = true;
});
it('commits RECEIVE_SET_LICENSE_APPROVAL and dispatches loadParsedLicenseReport', done => {
testAction(
actions.receiveSetLicenseApproval,
null,
state,
[{ type: mutationTypes.RECEIVE_SET_LICENSE_APPROVAL }],
[{ type: 'loadParsedLicenseReport' }],
)
.then(done)
.catch(done.fail);
});
});
describe('with the parsedLicenseReport feature flag disabled', () => {
beforeEach(() => {
gon.features.parsedLicenseReport = false;
});
it('commits RECEIVE_SET_LICENSE_APPROVAL and dispatches loadManagedLicenses', done => {
testAction(
actions.receiveSetLicenseApproval,
null,
state,
[{ type: mutationTypes.RECEIVE_SET_LICENSE_APPROVAL }],
[{ type: 'loadManagedLicenses' }],
)
.then(done)
.catch(done.fail);
});
}); });
}); });
......
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