Commit 683fa3d2 authored by Mark Florian's avatar Mark Florian

Align Secret Detection module with SAST

The existing SAST Vuex module was only superficially different from the
new Secret Detection module. The only real difference is the passing of
the relevant report type to the `fetchDiffData` function.

I've intentionally made these two modules nearly identical to aid future
refactoring to de-duplicate these via a factory pattern, or similar.
parent 65c792cf
import { fetchDiffData } from '../../utils'; import { fetchDiffData } from '../../utils';
import * as types from './mutation_types'; import * as types from './mutation_types';
export const setSecretScanningDiffEndpoint = ({ commit }, path) => export const setDiffEndpoint = ({ commit }, path) => commit(types.SET_DIFF_ENDPOINT, path);
commit(types.SET_SECRET_SCANNING_DIFF_ENDPOINT, path);
export const requestSecretScanningDiff = ({ commit }) => commit(types.REQUEST_SECRET_SCANNING_DIFF); export const requestDiff = ({ commit }) => commit(types.REQUEST_DIFF);
export const receiveSecretScanningDiffSuccess = ({ commit }, response) => export const receiveDiffSuccess = ({ commit }, response) =>
commit(types.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS, response); commit(types.RECEIVE_DIFF_SUCCESS, response);
export const receiveSecretScanningDiffError = ({ commit }, error) => export const receiveDiffError = ({ commit }, response) =>
commit(types.RECEIVE_SECRET_SCANNING_DIFF_ERROR, error); commit(types.RECEIVE_DIFF_ERROR, response);
export const fetchSecretScanningDiff = ({ state, rootState, dispatch }) => { export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestSecretScanningDiff'); dispatch('requestDiff');
return fetchDiffData(rootState, state.paths.diffEndpoint, 'secret_detection') return fetchDiffData(rootState, state.paths.diffEndpoint, 'secret_detection')
.then(data => { .then(data => {
dispatch('receiveSecretScanningDiffSuccess', data); dispatch('receiveDiffSuccess', data);
}) })
.catch(() => { .catch(() => {
dispatch('receiveSecretScanningDiffError'); dispatch('receiveDiffError');
}); });
}; };
export const RECEIVE_SECRET_SCANNING_DIFF_SUCCESS = 'RECEIVE_SECRET_SCANNING_DIFF_SUCCESS'; export const RECEIVE_DIFF_SUCCESS = 'RECEIVE_DIFF_SUCCESS';
export const RECEIVE_SECRET_SCANNING_DIFF_ERROR = 'RECEIVE_SECRET_SCANNING_DIFF_ERROR'; export const RECEIVE_DIFF_ERROR = 'RECEIVE_DIFF_ERROR';
export const REQUEST_SECRET_SCANNING_DIFF = 'REQUEST_SECRET_SCANNING_DIFF'; export const REQUEST_DIFF = 'REQUEST_DIFF';
export const SET_SECRET_SCANNING_DIFF_ENDPOINT = 'SET_SECRET_SCANNING_DIFF_ENDPOINT'; export const SET_DIFF_ENDPOINT = 'SET_DIFF_ENDPOINT';
...@@ -3,29 +3,29 @@ import { parseDiff } from '~/vue_shared/security_reports/store/utils'; ...@@ -3,29 +3,29 @@ import { parseDiff } from '~/vue_shared/security_reports/store/utils';
import * as types from './mutation_types'; import * as types from './mutation_types';
export default { export default {
[types.SET_SECRET_SCANNING_DIFF_ENDPOINT](state, path) { [types.SET_DIFF_ENDPOINT](state, path) {
Vue.set(state.paths, 'diffEndpoint', path); Vue.set(state.paths, 'diffEndpoint', path);
}, },
[types.REQUEST_SECRET_SCANNING_DIFF](state) { [types.REQUEST_DIFF](state) {
Vue.set(state, 'isLoading', true); state.isLoading = true;
}, },
[types.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS](state, { diff, enrichData }) { [types.RECEIVE_DIFF_SUCCESS](state, { diff, enrichData }) {
const { added, fixed, existing } = parseDiff(diff, enrichData); const { added, fixed, existing } = parseDiff(diff, enrichData);
const baseReportOutofDate = diff.base_report_out_of_date || false; const baseReportOutofDate = diff.base_report_out_of_date || false;
const hasBaseReport = Boolean(diff.base_report_created_at); const hasBaseReport = Boolean(diff.base_report_created_at);
Vue.set(state, 'isLoading', false); state.isLoading = false;
Vue.set(state, 'newIssues', added); state.newIssues = added;
Vue.set(state, 'resolvedIssues', fixed); state.resolvedIssues = fixed;
Vue.set(state, 'allIssues', existing); state.allIssues = existing;
Vue.set(state, 'baseReportOutofDate', baseReportOutofDate); state.baseReportOutofDate = baseReportOutofDate;
Vue.set(state, 'hasBaseReport', hasBaseReport); state.hasBaseReport = hasBaseReport;
}, },
[types.RECEIVE_SECRET_SCANNING_DIFF_ERROR](state) { [types.RECEIVE_DIFF_ERROR](state) {
Vue.set(state, 'isLoading', false); state.isLoading = false;
Vue.set(state, 'hasError', true); state.hasError = true;
}, },
}; };
...@@ -309,8 +309,8 @@ export default { ...@@ -309,8 +309,8 @@ export default {
const secretScanningDiffEndpoint = gl?.mrWidgetData?.secret_scanning_comparison_path; const secretScanningDiffEndpoint = gl?.mrWidgetData?.secret_scanning_comparison_path;
if (secretScanningDiffEndpoint && this.hasSecretScanningReports) { if (secretScanningDiffEndpoint && this.hasSecretScanningReports) {
this.setSecretScanningDiffEndpoint(secretScanningDiffEndpoint); this.setSecretDetectionDiffEndpoint(secretScanningDiffEndpoint);
this.fetchSecretScanningDiff(); this.fetchSecretDetectionDiff();
} }
const coverageFuzzingDiffEndpoint = gl?.mrWidgetData?.coverage_fuzzing_comparison_path; const coverageFuzzingDiffEndpoint = gl?.mrWidgetData?.coverage_fuzzing_comparison_path;
...@@ -359,8 +359,8 @@ export default { ...@@ -359,8 +359,8 @@ export default {
fetchSastDiff: 'fetchDiff', fetchSastDiff: 'fetchDiff',
}), }),
...mapActions('secretScanning', { ...mapActions('secretScanning', {
setSecretScanningDiffEndpoint: 'setSecretScanningDiffEndpoint', setSecretDetectionDiffEndpoint: 'setDiffEndpoint',
fetchSecretScanningDiff: 'fetchSecretScanningDiff', fetchSecretDetectionDiff: 'fetchDiff',
}), }),
...mapActions('pipelineJobs', ['fetchPipelineJobs', 'setPipelineJobsPath', 'setProjectId']), ...mapActions('pipelineJobs', ['fetchPipelineJobs', 'setPipelineJobsPath', 'setProjectId']),
...mapActions('pipelineJobs', { ...mapActions('pipelineJobs', {
......
...@@ -5,7 +5,7 @@ export const updateIssueActionsMap = { ...@@ -5,7 +5,7 @@ export const updateIssueActionsMap = {
dependency_scanning: 'updateDependencyScanningIssue', dependency_scanning: 'updateDependencyScanningIssue',
container_scanning: 'updateContainerScanningIssue', container_scanning: 'updateContainerScanningIssue',
dast: 'updateDastIssue', dast: 'updateDastIssue',
secret_detection: 'secretScanning/updateSecretScanningIssue', secret_detection: 'secretScanning/updateVulnerability',
coverage_fuzzing: 'updateCoverageFuzzingIssue', coverage_fuzzing: 'updateCoverageFuzzingIssue',
}; };
......
...@@ -2,5 +2,5 @@ import * as types from './mutation_types'; ...@@ -2,5 +2,5 @@ import * as types from './mutation_types';
export * from '~/vue_shared/security_reports/store/modules/secret_detection/actions'; export * from '~/vue_shared/security_reports/store/modules/secret_detection/actions';
export const updateSecretScanningIssue = ({ commit }, issue) => export const updateVulnerability = ({ commit }, vulnerability) =>
commit(types.UPDATE_SECRET_SCANNING_ISSUE, issue); commit(types.UPDATE_VULNERABILITY, vulnerability);
export * from '~/vue_shared/security_reports/store/modules/secret_detection/mutation_types'; export * from '~/vue_shared/security_reports/store/modules/secret_detection/mutation_types';
export const UPDATE_SECRET_SCANNING_ISSUE = 'UPDATE_SECRET_SCANNING_ISSUE'; export const UPDATE_VULNERABILITY = 'UPDATE_VULNERABILITY';
...@@ -5,9 +5,7 @@ import * as types from './mutation_types'; ...@@ -5,9 +5,7 @@ import * as types from './mutation_types';
export default { export default {
...ceMutations, ...ceMutations,
[types.UPDATE_SECRET_SCANNING_ISSUE](state, issue) { [types.UPDATE_VULNERABILITY](state, issue) {
// Find issue in the correct list and update it
const newIssuesIndex = findIssueIndex(state.newIssues, issue); const newIssuesIndex = findIssueIndex(state.newIssues, issue);
if (newIssuesIndex !== -1) { if (newIssuesIndex !== -1) {
state.newIssues.splice(newIssuesIndex, 1, issue); state.newIssues.splice(newIssuesIndex, 1, issue);
...@@ -17,6 +15,7 @@ export default { ...@@ -17,6 +15,7 @@ export default {
const resolvedIssuesIndex = findIssueIndex(state.resolvedIssues, issue); const resolvedIssuesIndex = findIssueIndex(state.resolvedIssues, issue);
if (resolvedIssuesIndex !== -1) { if (resolvedIssuesIndex !== -1) {
state.resolvedIssues.splice(resolvedIssuesIndex, 1, issue); state.resolvedIssues.splice(resolvedIssuesIndex, 1, issue);
return;
} }
const allIssuesIndex = findIssueIndex(state.allIssues, issue); const allIssuesIndex = findIssueIndex(state.allIssues, issue);
......
...@@ -140,7 +140,7 @@ describe('Grouped security reports app', () => { ...@@ -140,7 +140,7 @@ describe('Grouped security reports app', () => {
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR), waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR),
waitForMutation( waitForMutation(
wrapper.vm.$store, wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_SECRET_SCANNING_DIFF_ERROR}`, `secretScanning/${secretScanningTypes.RECEIVE_DIFF_ERROR}`,
), ),
waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_ERROR), waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_ERROR),
]); ]);
...@@ -228,7 +228,7 @@ describe('Grouped security reports app', () => { ...@@ -228,7 +228,7 @@ describe('Grouped security reports app', () => {
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS), waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS),
waitForMutation( waitForMutation(
wrapper.vm.$store, wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS}`, `secretScanning/${secretScanningTypes.RECEIVE_DIFF_SUCCESS}`,
), ),
waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_SUCCESS), waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_SUCCESS),
]); ]);
...@@ -281,7 +281,7 @@ describe('Grouped security reports app', () => { ...@@ -281,7 +281,7 @@ describe('Grouped security reports app', () => {
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS), waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS),
waitForMutation( waitForMutation(
wrapper.vm.$store, wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS}`, `secretScanning/${secretScanningTypes.RECEIVE_DIFF_SUCCESS}`,
), ),
waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_SUCCESS), waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_SUCCESS),
]); ]);
...@@ -576,7 +576,7 @@ describe('Grouped security reports app', () => { ...@@ -576,7 +576,7 @@ describe('Grouped security reports app', () => {
return waitForMutation( return waitForMutation(
wrapper.vm.$store, wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS}`, `secretScanning/${secretScanningTypes.RECEIVE_DIFF_SUCCESS}`,
); );
}; };
...@@ -589,7 +589,7 @@ describe('Grouped security reports app', () => { ...@@ -589,7 +589,7 @@ describe('Grouped security reports app', () => {
expect(wrapper.find('[data-qa-selector="secret_scan_report"]').exists()).toBe(true); expect(wrapper.find('[data-qa-selector="secret_scan_report"]').exists()).toBe(true);
}); });
it('should set setSecretScanningDiffEndpoint', () => { it('should set setDiffEndpoint', () => {
expect(wrapper.vm.secretScanning.paths.diffEndpoint).toEqual(SECRET_SCANNING_DIFF_ENDPOINT); expect(wrapper.vm.secretScanning.paths.diffEndpoint).toEqual(SECRET_SCANNING_DIFF_ENDPOINT);
}); });
......
...@@ -13,15 +13,15 @@ describe('EE secret detection report actions', () => { ...@@ -13,15 +13,15 @@ describe('EE secret detection report actions', () => {
state = createState(); state = createState();
}); });
describe('updateSecretScanningIssue', () => { describe('updateVulnerability', () => {
it(`should commit ${types.UPDATE_SECRET_SCANNING_ISSUE} with the correct response`, done => { it(`should commit ${types.UPDATE_VULNERABILITY} with the correct response`, done => {
testAction( testAction(
actions.updateSecretScanningIssue, actions.updateVulnerability,
issue, issue,
state, state,
[ [
{ {
type: types.UPDATE_SECRET_SCANNING_ISSUE, type: types.UPDATE_VULNERABILITY,
payload: issue, payload: issue,
}, },
], ],
......
...@@ -13,7 +13,7 @@ describe('EE secret detection module mutations', () => { ...@@ -13,7 +13,7 @@ describe('EE secret detection module mutations', () => {
state = createState(); state = createState();
}); });
describe(types.UPDATE_SECRET_SCANNING_ISSUE, () => { describe(types.UPDATE_VULNERABILITY, () => {
let newIssue; let newIssue;
let resolvedIssue; let resolvedIssue;
let allIssue; let allIssue;
...@@ -30,7 +30,7 @@ describe('EE secret detection module mutations', () => { ...@@ -30,7 +30,7 @@ describe('EE secret detection module mutations', () => {
describe('with a `new` issue', () => { describe('with a `new` issue', () => {
beforeEach(() => { beforeEach(() => {
mutations[types.UPDATE_SECRET_SCANNING_ISSUE](state, { ...newIssue, changed: true }); mutations[types.UPDATE_VULNERABILITY](state, { ...newIssue, changed: true });
}); });
it('should update the correct issue', () => { it('should update the correct issue', () => {
...@@ -40,7 +40,7 @@ describe('EE secret detection module mutations', () => { ...@@ -40,7 +40,7 @@ describe('EE secret detection module mutations', () => {
describe('with a `resolved` issue', () => { describe('with a `resolved` issue', () => {
beforeEach(() => { beforeEach(() => {
mutations[types.UPDATE_SECRET_SCANNING_ISSUE](state, { ...resolvedIssue, changed: true }); mutations[types.UPDATE_VULNERABILITY](state, { ...resolvedIssue, changed: true });
}); });
it('should update the correct issue', () => { it('should update the correct issue', () => {
...@@ -50,7 +50,7 @@ describe('EE secret detection module mutations', () => { ...@@ -50,7 +50,7 @@ describe('EE secret detection module mutations', () => {
describe('with an `all` issue', () => { describe('with an `all` issue', () => {
beforeEach(() => { beforeEach(() => {
mutations[types.UPDATE_SECRET_SCANNING_ISSUE](state, { ...allIssue, changed: true }); mutations[types.UPDATE_VULNERABILITY](state, { ...allIssue, changed: true });
}); });
it('should update the correct issue', () => { it('should update the correct issue', () => {
...@@ -60,7 +60,7 @@ describe('EE secret detection module mutations', () => { ...@@ -60,7 +60,7 @@ describe('EE secret detection module mutations', () => {
describe('with an invalid issue', () => { describe('with an invalid issue', () => {
beforeEach(() => { beforeEach(() => {
mutations[types.UPDATE_SECRET_SCANNING_ISSUE]( mutations[types.UPDATE_VULNERABILITY](
state, state,
createIssue({ project_fingerprint: 'invalid', changed: true }), createIssue({ project_fingerprint: 'invalid', changed: true }),
); );
......
...@@ -25,15 +25,15 @@ describe('secret detection report actions', () => { ...@@ -25,15 +25,15 @@ describe('secret detection report actions', () => {
state = createState(); state = createState();
}); });
describe('setSecretScanningDiffEndpoint', () => { describe('setDiffEndpoint', () => {
it(`should commit ${types.SET_SECRET_SCANNING_DIFF_ENDPOINT} with the correct path`, done => { it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, done => {
testAction( testAction(
actions.setSecretScanningDiffEndpoint, actions.setDiffEndpoint,
diffEndpoint, diffEndpoint,
state, state,
[ [
{ {
type: types.SET_SECRET_SCANNING_DIFF_ENDPOINT, type: types.SET_DIFF_ENDPOINT,
payload: diffEndpoint, payload: diffEndpoint,
}, },
], ],
...@@ -43,28 +43,21 @@ describe('secret detection report actions', () => { ...@@ -43,28 +43,21 @@ describe('secret detection report actions', () => {
}); });
}); });
describe('requestSecretScanningDiff', () => { describe('requestDiff', () => {
it(`should commit ${types.REQUEST_SECRET_SCANNING_DIFF}`, done => { it(`should commit ${types.REQUEST_DIFF}`, done => {
testAction( testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done);
actions.requestSecretScanningDiff,
{},
state,
[{ type: types.REQUEST_SECRET_SCANNING_DIFF }],
[],
done,
);
}); });
}); });
describe('receiveSecretScanningDiffSuccess', () => { describe('receiveDiffSuccess', () => {
it(`should commit ${types.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS} with the correct response`, done => { it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, done => {
testAction( testAction(
actions.receiveSecretScanningDiffSuccess, actions.receiveDiffSuccess,
reports, reports,
state, state,
[ [
{ {
type: types.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS, type: types.RECEIVE_DIFF_SUCCESS,
payload: reports, payload: reports,
}, },
], ],
...@@ -74,15 +67,15 @@ describe('secret detection report actions', () => { ...@@ -74,15 +67,15 @@ describe('secret detection report actions', () => {
}); });
}); });
describe('receiveSecretScanningDiffError', () => { describe('receiveDiffError', () => {
it(`should commit ${types.RECEIVE_SECRET_SCANNING_DIFF_ERROR} with the correct response`, done => { it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, done => {
testAction( testAction(
actions.receiveSecretScanningDiffError, actions.receiveDiffError,
error, error,
state, state,
[ [
{ {
type: types.RECEIVE_SECRET_SCANNING_DIFF_ERROR, type: types.RECEIVE_DIFF_ERROR,
payload: error, payload: error,
}, },
], ],
...@@ -92,7 +85,7 @@ describe('secret detection report actions', () => { ...@@ -92,7 +85,7 @@ describe('secret detection report actions', () => {
}); });
}); });
describe('fetchSecretScanningDiff', () => { describe('fetchDiff', () => {
let mock; let mock;
beforeEach(() => { beforeEach(() => {
...@@ -117,14 +110,14 @@ describe('secret detection report actions', () => { ...@@ -117,14 +110,14 @@ describe('secret detection report actions', () => {
it('should dispatch the `receiveDiffSuccess` action', done => { it('should dispatch the `receiveDiffSuccess` action', done => {
const { diff, enrichData } = reports; const { diff, enrichData } = reports;
testAction( testAction(
actions.fetchSecretScanningDiff, actions.fetchDiff,
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[ [
{ type: 'requestSecretScanningDiff' }, { type: 'requestDiff' },
{ {
type: 'receiveSecretScanningDiffSuccess', type: 'receiveDiffSuccess',
payload: { payload: {
diff, diff,
enrichData, enrichData,
...@@ -142,18 +135,18 @@ describe('secret detection report actions', () => { ...@@ -142,18 +135,18 @@ describe('secret detection report actions', () => {
mock.onGet(diffEndpoint).replyOnce(200, reports.diff); mock.onGet(diffEndpoint).replyOnce(200, reports.diff);
}); });
it('should dispatch the `receiveSecretScanningDiffSuccess` action with empty enrich data', done => { it('should dispatch the `receiveDiffSuccess` action with empty enrich data', done => {
const { diff } = reports; const { diff } = reports;
const enrichData = []; const enrichData = [];
testAction( testAction(
actions.fetchSecretScanningDiff, actions.fetchDiff,
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[ [
{ type: 'requestSecretScanningDiff' }, { type: 'requestDiff' },
{ {
type: 'receiveSecretScanningDiffSuccess', type: 'receiveDiffSuccess',
payload: { payload: {
diff, diff,
enrichData, enrichData,
...@@ -174,13 +167,13 @@ describe('secret detection report actions', () => { ...@@ -174,13 +167,13 @@ describe('secret detection report actions', () => {
.replyOnce(404); .replyOnce(404);
}); });
it('should dispatch the `receiveSecretScanningDiffError` action', done => { it('should dispatch the `receiveDiffError` action', done => {
testAction( testAction(
actions.fetchSecretScanningDiff, actions.fetchDiff,
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[{ type: 'requestSecretScanningDiff' }, { type: 'receiveSecretScanningDiffError' }], [{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done, done,
); );
}); });
...@@ -195,13 +188,13 @@ describe('secret detection report actions', () => { ...@@ -195,13 +188,13 @@ describe('secret detection report actions', () => {
.replyOnce(200, reports.enrichData); .replyOnce(200, reports.enrichData);
}); });
it('should dispatch the `receiveSecretScanningDiffError` action', done => { it('should dispatch the `receiveDiffError` action', done => {
testAction( testAction(
actions.fetchSecretScanningDiff, actions.fetchDiff,
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[{ type: 'requestSecretScanningDiff' }, { type: 'receiveSecretScanningDiffError' }], [{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done, done,
); );
}); });
......
...@@ -12,23 +12,23 @@ describe('secret detection module mutations', () => { ...@@ -12,23 +12,23 @@ describe('secret detection module mutations', () => {
state = createState(); state = createState();
}); });
describe(types.SET_SECRET_SCANNING_DIFF_ENDPOINT, () => { describe(types.SET_DIFF_ENDPOINT, () => {
it('should set the secret detection diff endpoint', () => { it('should set the secret detection diff endpoint', () => {
mutations[types.SET_SECRET_SCANNING_DIFF_ENDPOINT](state, path); mutations[types.SET_DIFF_ENDPOINT](state, path);
expect(state.paths.diffEndpoint).toBe(path); expect(state.paths.diffEndpoint).toBe(path);
}); });
}); });
describe(types.REQUEST_SECRET_SCANNING_DIFF, () => { describe(types.REQUEST_DIFF, () => {
it('should set the `isLoading` status to `true`', () => { it('should set the `isLoading` status to `true`', () => {
mutations[types.REQUEST_SECRET_SCANNING_DIFF](state); mutations[types.REQUEST_DIFF](state);
expect(state.isLoading).toBe(true); expect(state.isLoading).toBe(true);
}); });
}); });
describe(types.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS, () => { describe(types.RECEIVE_DIFF_SUCCESS, () => {
beforeEach(() => { beforeEach(() => {
const reports = { const reports = {
diff: { diff: {
...@@ -43,7 +43,7 @@ describe('secret detection module mutations', () => { ...@@ -43,7 +43,7 @@ describe('secret detection module mutations', () => {
}, },
}; };
state.isLoading = true; state.isLoading = true;
mutations[types.RECEIVE_SECRET_SCANNING_DIFF_SUCCESS](state, reports); mutations[types.RECEIVE_DIFF_SUCCESS](state, reports);
}); });
it('should set the `isLoading` status to `false`', () => { it('should set the `isLoading` status to `false`', () => {
...@@ -67,10 +67,10 @@ describe('secret detection module mutations', () => { ...@@ -67,10 +67,10 @@ describe('secret detection module mutations', () => {
}); });
}); });
describe(types.RECEIVE_SECRET_SCANNING_DIFF_ERROR, () => { describe(types.RECEIVE_DIFF_ERROR, () => {
beforeEach(() => { beforeEach(() => {
state.isLoading = true; state.isLoading = true;
mutations[types.RECEIVE_SECRET_SCANNING_DIFF_ERROR](state); mutations[types.RECEIVE_DIFF_ERROR](state);
}); });
it('should set the `isLoading` status to `false`', () => { it('should set the `isLoading` status to `false`', () => {
......
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