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 }) => { ...@@ -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