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'; ...@@ -4,7 +4,7 @@ import * as types from './mutation_types';
export const setDiffEndpoint = ({ commit }, path) => commit(types.SET_DIFF_ENDPOINT, path); 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) => export const updateVulnerability = ({ commit }, vulnerability) =>
commit(types.UPDATE_VULNERABILITY, vulnerability); commit(types.UPDATE_VULNERABILITY, vulnerability);
...@@ -16,7 +16,7 @@ export const receiveDiffError = ({ commit }, response) => ...@@ -16,7 +16,7 @@ export const receiveDiffError = ({ commit }, response) =>
commit(types.RECEIVE_DIFF_ERROR, response); commit(types.RECEIVE_DIFF_ERROR, response);
export const fetchDiff = ({ state, rootState, dispatch }) => { export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestReports'); dispatch('requestDiff');
return Promise.all([ return Promise.all([
pollUntilComplete(state.paths.diffEndpoint), pollUntilComplete(state.paths.diffEndpoint),
......
export const RECEIVE_DIFF_SUCCESS = 'RECEIVE_DIFF_SUCCESS'; export const RECEIVE_DIFF_SUCCESS = 'RECEIVE_DIFF_SUCCESS';
export const RECEIVE_DIFF_ERROR = 'RECEIVE_DIFF_ERROR'; 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 SET_DIFF_ENDPOINT = 'SET_DIFF_ENDPOINT';
export const UPDATE_VULNERABILITY = 'UPDATE_VULNERABILITY'; export const UPDATE_VULNERABILITY = 'UPDATE_VULNERABILITY';
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
Vue.set(state.paths, 'diffEndpoint', path); Vue.set(state.paths, 'diffEndpoint', path);
}, },
[types.REQUEST_REPORTS](state) { [types.REQUEST_DIFF](state) {
state.isLoading = true; state.isLoading = true;
}, },
......
...@@ -44,9 +44,9 @@ describe('sast report actions', () => { ...@@ -44,9 +44,9 @@ describe('sast report actions', () => {
}); });
}); });
describe('requestReports', () => { describe('requestDiff', () => {
it(`should commit ${types.REQUEST_REPORTS}`, done => { it(`should commit ${types.REQUEST_DIFF}`, done => {
testAction(actions.requestReports, {}, state, [{ type: types.REQUEST_REPORTS }], [], done); testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done);
}); });
}); });
...@@ -115,7 +115,7 @@ describe('sast report actions', () => { ...@@ -115,7 +115,7 @@ describe('sast report actions', () => {
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[ [
{ type: 'requestReports' }, { type: 'requestDiff' },
{ {
type: 'receiveDiffSuccess', type: 'receiveDiffSuccess',
payload: { payload: {
...@@ -144,7 +144,7 @@ describe('sast report actions', () => { ...@@ -144,7 +144,7 @@ describe('sast report actions', () => {
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[{ type: 'requestReports' }, { type: 'receiveDiffError' }], [{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done, done,
); );
}); });
...@@ -165,7 +165,7 @@ describe('sast report actions', () => { ...@@ -165,7 +165,7 @@ describe('sast report actions', () => {
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[{ type: 'requestReports' }, { type: 'receiveDiffError' }], [{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done, done,
); );
}); });
......
...@@ -20,9 +20,9 @@ describe('sast module mutations', () => { ...@@ -20,9 +20,9 @@ describe('sast module mutations', () => {
}); });
}); });
describe(types.REQUEST_REPORTS, () => { describe(types.REQUEST_DIFF, () => {
it('should set the `isLoading` status to `true`', () => { it('should set the `isLoading` status to `true`', () => {
mutations[types.REQUEST_REPORTS](state); mutations[types.REQUEST_DIFF](state);
expect(state.isLoading).toBe(true); 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