Commit b5ac9eb4 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '196719-make-vuex-store-consistent' into 'master'

Align VueX actions for Secure diff results

See merge request gitlab-org/gitlab!23826
parents 6c1b45ff 48ec35be
......@@ -93,7 +93,7 @@ export const updateContainerScanningIssue = ({ commit }, issue) =>
*/
export const setDastDiffEndpoint = ({ commit }, path) => commit(types.SET_DAST_DIFF_ENDPOINT, path);
export const requestDastReports = ({ commit }) => commit(types.REQUEST_DAST_REPORTS);
export const requestDastDiff = ({ commit }) => commit(types.REQUEST_DAST_DIFF);
export const updateDastIssue = ({ commit }, issue) => commit(types.UPDATE_DAST_ISSUE, issue);
......@@ -103,7 +103,7 @@ export const receiveDastDiffSuccess = ({ commit }, response) =>
export const receiveDastDiffError = ({ commit }) => commit(types.RECEIVE_DAST_DIFF_ERROR);
export const fetchDastDiff = ({ state, dispatch }) => {
dispatch('requestDastReports');
dispatch('requestDastDiff');
return Promise.all([
pollUntilComplete(state.dast.paths.diffEndpoint),
......@@ -131,8 +131,8 @@ export const fetchDastDiff = ({ state, dispatch }) => {
export const setDependencyScanningDiffEndpoint = ({ commit }, path) =>
commit(types.SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT, path);
export const requestDependencyScanningReports = ({ commit }) =>
commit(types.REQUEST_DEPENDENCY_SCANNING_REPORTS);
export const requestDependencyScanningDiff = ({ commit }) =>
commit(types.REQUEST_DEPENDENCY_SCANNING_DIFF);
export const receiveDependencyScanningDiffSuccess = ({ commit }, response) =>
commit(types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS, response);
......@@ -141,7 +141,7 @@ export const receiveDependencyScanningDiffError = ({ commit }) =>
commit(types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR);
export const fetchDependencyScanningDiff = ({ state, dispatch }) => {
dispatch('requestDependencyScanningReports');
dispatch('requestDependencyScanningDiff');
return Promise.all([
pollUntilComplete(state.dependencyScanning.paths.diffEndpoint),
......
......@@ -4,7 +4,7 @@ import * as types from './mutation_types';
export const setDiffEndpoint = ({ commit }, path) => commit(types.SET_DIFF_ENDPOINT, path);
export const requestReports = ({ commit }) => commit(types.REQUEST_REPORTS);
export const requestDiff = ({ commit }) => commit(types.REQUEST_DIFF);
export const updateVulnerability = ({ commit }, vulnerability) =>
commit(types.UPDATE_VULNERABILITY, vulnerability);
......@@ -16,7 +16,7 @@ export const receiveDiffError = ({ commit }, response) =>
commit(types.RECEIVE_DIFF_ERROR, response);
export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestReports');
dispatch('requestDiff');
return Promise.all([
pollUntilComplete(state.paths.diffEndpoint),
......
export const RECEIVE_DIFF_SUCCESS = 'RECEIVE_DIFF_SUCCESS';
export const RECEIVE_DIFF_ERROR = 'RECEIVE_DIFF_ERROR';
export const REQUEST_REPORTS = 'REQUEST_REPORTS';
export const REQUEST_DIFF = 'REQUEST_DIFF';
export const SET_DIFF_ENDPOINT = 'SET_DIFF_ENDPOINT';
export const UPDATE_VULNERABILITY = 'UPDATE_VULNERABILITY';
......@@ -7,7 +7,7 @@ export default {
Vue.set(state.paths, 'diffEndpoint', path);
},
[types.REQUEST_REPORTS](state) {
[types.REQUEST_DIFF](state) {
state.isLoading = true;
},
......
......@@ -21,13 +21,13 @@ export const RECEIVE_SAST_CONTAINER_DIFF_ERROR = 'RECEIVE_SAST_CONTAINER_DIFF_ER
// DAST
export const SET_DAST_DIFF_ENDPOINT = 'SET_DAST_DIFF_ENDPOINT';
export const REQUEST_DAST_REPORTS = 'REQUEST_DAST_REPORTS';
export const REQUEST_DAST_DIFF = 'REQUEST_DAST_DIFF';
export const RECEIVE_DAST_DIFF_SUCCESS = 'RECEIVE_DAST_DIFF_SUCCESS';
export const RECEIVE_DAST_DIFF_ERROR = 'RECEIVE_DAST_DIFF_ERROR';
// DEPENDENCY_SCANNING
export const SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT = 'SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT';
export const REQUEST_DEPENDENCY_SCANNING_REPORTS = 'REQUEST_DEPENDENCY_SCANNING_REPORTS';
export const REQUEST_DEPENDENCY_SCANNING_DIFF = 'REQUEST_DEPENDENCY_SCANNING_DIFF';
export const RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS = 'RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS';
export const RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR = 'RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR';
......
......@@ -82,7 +82,7 @@ export default {
Vue.set(state.dast.paths, 'diffEndpoint', path);
},
[types.REQUEST_DAST_REPORTS](state) {
[types.REQUEST_DAST_DIFF](state) {
Vue.set(state.dast, 'isLoading', true);
},
......@@ -110,7 +110,7 @@ export default {
Vue.set(state.dependencyScanning.paths, 'diffEndpoint', path);
},
[types.REQUEST_DEPENDENCY_SCANNING_REPORTS](state) {
[types.REQUEST_DEPENDENCY_SCANNING_DIFF](state) {
Vue.set(state.dependencyScanning, 'isLoading', true);
},
......
......@@ -8,8 +8,8 @@ import {
setCanCreateIssuePermission,
setCanCreateFeedbackPermission,
requestSastContainerReports,
requestDastReports,
requestDependencyScanningReports,
requestDastDiff,
requestDependencyScanningDiff,
openModal,
setModalData,
requestDismissVulnerability,
......@@ -247,15 +247,15 @@ describe('security reports actions', () => {
});
});
describe('requestDastReports', () => {
describe('requestDastDiff', () => {
it('should commit request mutation', done => {
testAction(
requestDastReports,
requestDastDiff,
null,
mockedState,
[
{
type: types.REQUEST_DAST_REPORTS,
type: types.REQUEST_DAST_DIFF,
},
],
[],
......@@ -264,15 +264,15 @@ describe('security reports actions', () => {
});
});
describe('requestDependencyScanningReports', () => {
describe('requestDependencyScanningDiff', () => {
it('should commit request mutation', done => {
testAction(
requestDependencyScanningReports,
requestDependencyScanningDiff,
null,
mockedState,
[
{
type: types.REQUEST_DEPENDENCY_SCANNING_REPORTS,
type: types.REQUEST_DEPENDENCY_SCANNING_DIFF,
},
],
[],
......@@ -1327,7 +1327,7 @@ describe('security reports actions', () => {
[],
[
{
type: 'requestDependencyScanningReports',
type: 'requestDependencyScanningDiff',
},
{
type: 'receiveDependencyScanningDiffSuccess',
......@@ -1360,7 +1360,7 @@ describe('security reports actions', () => {
[],
[
{
type: 'requestDependencyScanningReports',
type: 'requestDependencyScanningDiff',
},
{
type: 'receiveDependencyScanningDiffError',
......@@ -1389,7 +1389,7 @@ describe('security reports actions', () => {
[],
[
{
type: 'requestDependencyScanningReports',
type: 'requestDependencyScanningDiff',
},
{
type: 'receiveDependencyScanningDiffError',
......@@ -1484,7 +1484,7 @@ describe('security reports actions', () => {
[],
[
{
type: 'requestDastReports',
type: 'requestDastDiff',
},
{
type: 'receiveDastDiffSuccess',
......@@ -1517,7 +1517,7 @@ describe('security reports actions', () => {
[],
[
{
type: 'requestDastReports',
type: 'requestDastDiff',
},
{
type: 'receiveDastDiffError',
......@@ -1546,7 +1546,7 @@ describe('security reports actions', () => {
[],
[
{
type: 'requestDastReports',
type: 'requestDastDiff',
},
{
type: 'receiveDastDiffError',
......
......@@ -44,9 +44,9 @@ describe('sast report actions', () => {
});
});
describe('requestReports', () => {
it(`should commit ${types.REQUEST_REPORTS}`, done => {
testAction(actions.requestReports, {}, state, [{ type: types.REQUEST_REPORTS }], [], done);
describe('requestDiff', () => {
it(`should commit ${types.REQUEST_DIFF}`, done => {
testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done);
});
});
......@@ -115,7 +115,7 @@ describe('sast report actions', () => {
{ ...rootState, ...state },
[],
[
{ type: 'requestReports' },
{ type: 'requestDiff' },
{
type: 'receiveDiffSuccess',
payload: {
......@@ -144,7 +144,7 @@ describe('sast report actions', () => {
{},
{ ...rootState, ...state },
[],
[{ type: 'requestReports' }, { type: 'receiveDiffError' }],
[{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done,
);
});
......@@ -165,7 +165,7 @@ describe('sast report actions', () => {
{},
{ ...rootState, ...state },
[],
[{ type: 'requestReports' }, { type: 'receiveDiffError' }],
[{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done,
);
});
......
......@@ -20,9 +20,9 @@ describe('sast module mutations', () => {
});
});
describe(types.REQUEST_REPORTS, () => {
describe(types.REQUEST_DIFF, () => {
it('should set the `isLoading` status to `true`', () => {
mutations[types.REQUEST_REPORTS](state);
mutations[types.REQUEST_DIFF](state);
expect(state.isLoading).toBe(true);
});
......
......@@ -79,17 +79,17 @@ describe('security reports mutations', () => {
});
});
describe('REQUEST_DAST_REPORTS', () => {
describe('REQUEST_DAST_DIFF', () => {
it('should set dast loading flag to true', () => {
mutations[types.REQUEST_DAST_REPORTS](stateCopy);
mutations[types.REQUEST_DAST_DIFF](stateCopy);
expect(stateCopy.dast.isLoading).toEqual(true);
});
});
describe('REQUEST_DEPENDENCY_SCANNING_REPORTS', () => {
describe('REQUEST_DEPENDENCY_SCANNING_DIFF', () => {
it('should set dependency scanning loading flag to true', () => {
mutations[types.REQUEST_DEPENDENCY_SCANNING_REPORTS](stateCopy);
mutations[types.REQUEST_DEPENDENCY_SCANNING_DIFF](stateCopy);
expect(stateCopy.dependencyScanning.isLoading).toEqual(true);
});
......
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