Commit 8a55f897 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'retrigger-license-compliance' into 'master'

Triggers the correct endpoint on licence approval

See merge request gitlab-org/gitlab!19078
parents 5eb29e23 a51a23e4
---
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