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 }) => {
};
export const receiveSetLicenseApproval = ({ commit, dispatch }) => {
commit(types.RECEIVE_SET_LICENSE_APPROVAL);
dispatch('loadManagedLicenses');
if (gon.features && gon.features.parsedLicenseReport) {
dispatch('loadParsedLicenseReport');
} else {
dispatch('loadManagedLicenses');
}
};
export const receiveSetLicenseApprovalError = ({ commit }, error) => {
commit(types.RECEIVE_SET_LICENSE_APPROVAL_ERROR, error);
......
......@@ -186,16 +186,47 @@ describe('License store actions', () => {
});
describe('receiveSetLicenseApproval', () => {
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);
gon.features = gon.features || {};
const { parsedLicenseReport } = gon.features;
afterEach(() => {
gon.features.parsedLicenseReport = parsedLicenseReport;
});
describe('with the parsedLicenseReport feature flag enabled', () => {
beforeEach(() => {
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