Commit 82c8a0ba authored by Lukas Eipert's avatar Lukas Eipert

Vuex: Rename SAST report to diff

For consistency, we rename the action `requestReports` and associated
mutations to `requestDiff`
parent 1c4e95cb
......@@ -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;
},
......
......@@ -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);
});
......
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