Commit 784eff81 authored by Fernando's avatar Fernando Committed by Jose Ivan Vargas

Rename MR to MergeRequest

Apply variable/function renames

Remove null
parent 8378a3c6
......@@ -16,7 +16,7 @@ import {
import securityReportDownloadPathsQuery from './queries/security_report_download_paths.query.graphql';
import store from './store';
import { MODULE_SAST, MODULE_SECRET_DETECTION } from './store/constants';
import { extractSecurityReportArtifactsFromMr } from './utils';
import { extractSecurityReportArtifactsFromMergeRequest } from './utils';
export default {
store,
......@@ -97,7 +97,7 @@ export default {
};
},
update(data) {
return extractSecurityReportArtifactsFromMr(this.$options.reportTypes, data);
return extractSecurityReportArtifactsFromMergeRequest(this.$options.reportTypes, data);
},
error(error) {
this.showError(error);
......
......@@ -45,7 +45,7 @@ export const extractSecurityReportArtifactsFromPipeline = (reportTypes, data) =>
return extractSecurityReportArtifacts(reportTypes, jobs);
};
export const extractSecurityReportArtifactsFromMr = (reportTypes, data) => {
export const extractSecurityReportArtifactsFromMergeRequest = (reportTypes, data) => {
const jobs = data.project?.mergeRequest?.headPipeline?.jobs?.nodes ?? [];
return extractSecurityReportArtifacts(reportTypes, jobs);
};
......@@ -4,7 +4,7 @@ import createFlash from '~/flash';
import { s__ } from '~/locale';
import SecurityReportDownloadDropdown from '~/vue_shared/security_reports/components/security_report_download_dropdown.vue';
import securityReportDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_download_paths.query.graphql';
import { extractSecurityReportArtifactsFromMr } from '~/vue_shared/security_reports/utils';
import { extractSecurityReportArtifactsFromMergeRequest } from '~/vue_shared/security_reports/utils';
export default {
components: {
......@@ -45,7 +45,7 @@ export default {
};
},
update(data) {
return extractSecurityReportArtifactsFromMr(this.reportTypes, data);
return extractSecurityReportArtifactsFromMergeRequest(this.reportTypes, data);
},
error(error) {
this.showError(error);
......
......@@ -4,7 +4,7 @@ import createFlash from '~/flash';
import { s__ } from '~/locale';
import SecurityReportDownloadDropdown from '~/vue_shared/security_reports/components/security_report_download_dropdown.vue';
import securityReportDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_mr_download_paths.query.graphql';
import { extractSecurityReportArtifactsFromMr } from '~/vue_shared/security_reports/utils';
import { extractSecurityReportArtifactsFromMergeRequest } from '~/vue_shared/security_reports/utils';
export default {
components: {
......@@ -45,7 +45,7 @@ export default {
};
},
update(data) {
return extractSecurityReportArtifactsFromMr(this.reportTypes, data);
return extractSecurityReportArtifactsFromMergeRequest(this.reportTypes, data);
},
error(error) {
this.showError(error);
......
......@@ -20,7 +20,7 @@ import createMockApollo from 'helpers/mock_apollo_helper';
import { TEST_HOST } from 'helpers/test_constants';
import { trimText } from 'helpers/text_helper';
import waitForPromises from 'helpers/wait_for_promises';
import { securityReportDownloadPathsQueryResponse } from 'jest/vue_shared/security_reports/mock_data';
import { securityReportMergeRequestDownloadPathsQueryResponse } from 'jest/vue_shared/security_reports/mock_data';
import axios from '~/lib/utils/axios_utils';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
......@@ -29,7 +29,7 @@ import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/consta
// Force Jest to transpile and cache
// eslint-disable-next-line no-unused-vars
import _Deployment from '~/vue_merge_request_widget/components/deployment/deployment.vue';
import securityReportDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_download_paths.query.graphql';
import securityReportMergeRequestDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_mr_download_paths.query.graphql';
import mockData, {
baseBrowserPerformance,
......@@ -781,6 +781,7 @@ describe('ee merge request widget options', () => {
beforeEach(() => {
gl.mrWidgetData = {
...mockData,
target_project_full_path: '',
enabled_reports: {
coverage_fuzzing: true,
},
......@@ -1037,8 +1038,8 @@ describe('ee merge request widget options', () => {
propsData: { mrData: gl.mrWidgetData },
apolloProvider: createMockApollo([
[
securityReportDownloadPathsQuery,
async () => ({ data: securityReportDownloadPathsQueryResponse }),
securityReportMergeRequestDownloadPathsQuery,
async () => ({ data: securityReportMergeRequestDownloadPathsQueryResponse }),
],
]),
});
......
......@@ -9,15 +9,15 @@ import {
import createMockApollo from 'helpers/mock_apollo_helper';
import {
expectedDownloadDropdownProps,
securityReportMrDownloadPathsQueryResponse,
securityReportMergeRequestDownloadPathsQueryResponse,
} from 'jest/vue_shared/security_reports/mock_data';
import createFlash from '~/flash';
import SecurityReportDownloadDropdown from '~/vue_shared/security_reports/components/security_report_download_dropdown.vue';
import securityReportMrDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_mr_download_paths.query.graphql';
import securityReportMergeRequestDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_mr_download_paths.query.graphql';
jest.mock('~/flash');
describe('Mr Artifact Download', () => {
describe('Merge request artifact Download', () => {
let wrapper;
const defaultProps = {
......@@ -41,11 +41,11 @@ describe('Mr Artifact Download', () => {
const pendingHandler = () => new Promise(() => {});
const successHandler = () =>
Promise.resolve({ data: securityReportMrDownloadPathsQueryResponse });
Promise.resolve({ data: securityReportMergeRequestDownloadPathsQueryResponse });
const failureHandler = () => Promise.resolve({ errors: [{ message: 'some error' }] });
const createMockApolloProvider = (handler) => {
Vue.use(VueApollo);
const requestHandlers = [[securityReportMrDownloadPathsQuery, handler]];
const requestHandlers = [[securityReportMergeRequestDownloadPathsQuery, handler]];
return createMockApollo(requestHandlers);
};
......@@ -54,7 +54,6 @@ describe('Mr Artifact Download', () => {
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('given the query is loading', () => {
......
......@@ -17,7 +17,7 @@ import securityReportPipelineDownloadPathsQuery from '~/vue_shared/security_repo
jest.mock('~/flash');
describe('Mr Artifact Download', () => {
describe('Pipeline artifact Download', () => {
let wrapper;
const defaultProps = {
......@@ -54,7 +54,6 @@ describe('Mr Artifact Download', () => {
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('given the query is loading', () => {
......
......@@ -339,7 +339,7 @@ export const securityReportDownloadPathsQueryNoArtifactsResponse = {
},
};
export const securityReportMrDownloadPathsQueryResponse = {
export const securityReportMergeRequestDownloadPathsQueryResponse = {
project: {
mergeRequest: {
headPipeline: {
......@@ -447,7 +447,7 @@ export const securityReportMrDownloadPathsQueryResponse = {
},
};
export const securityReportDownloadPathsQueryResponse = securityReportMrDownloadPathsQueryResponse;
export const securityReportDownloadPathsQueryResponse = securityReportMergeRequestDownloadPathsQueryResponse;
export const securityReportPipelineDownloadPathsQueryResponse = {
project: {
......
......@@ -4,11 +4,11 @@ import {
REPORT_FILE_TYPES,
} from '~/vue_shared/security_reports/constants';
import {
extractSecurityReportArtifactsFromMr,
extractSecurityReportArtifactsFromMergeRequest,
extractSecurityReportArtifactsFromPipeline,
} from '~/vue_shared/security_reports/utils';
import {
securityReportMrDownloadPathsQueryResponse,
securityReportMergeRequestDownloadPathsQueryResponse,
securityReportPipelineDownloadPathsQueryResponse,
sastArtifacts,
secretDetectionArtifacts,
......@@ -17,7 +17,18 @@ import {
metadataArtifacts,
} from './mock_data';
describe('extractSecurityReportArtifactsFromMr', () => {
describe.each([
[
'extractSecurityReportArtifactsFromMergeRequest',
extractSecurityReportArtifactsFromMergeRequest,
securityReportMergeRequestDownloadPathsQueryResponse,
],
[
'extractSecurityReportArtifactsFromPipelines',
extractSecurityReportArtifactsFromPipeline,
securityReportPipelineDownloadPathsQueryResponse,
],
])('%s', (funcName, extractFunc, response) => {
it.each`
reportTypes | expectedArtifacts
${[]} | ${[]}
......@@ -31,36 +42,7 @@ describe('extractSecurityReportArtifactsFromMr', () => {
`(
'returns the expected artifacts given report types $reportTypes',
({ reportTypes, expectedArtifacts }) => {
expect(
extractSecurityReportArtifactsFromMr(
reportTypes,
securityReportMrDownloadPathsQueryResponse,
),
).toEqual(expectedArtifacts);
},
);
});
describe('extractSecurityReportArtifactsFromPipeline', () => {
it.each`
reportTypes | expectedArtifacts
${[]} | ${[]}
${['foo']} | ${[]}
${[REPORT_TYPE_SAST]} | ${sastArtifacts}
${[REPORT_TYPE_SECRET_DETECTION]} | ${secretDetectionArtifacts}
${[REPORT_TYPE_SAST, REPORT_TYPE_SECRET_DETECTION]} | ${[...secretDetectionArtifacts, ...sastArtifacts]}
${[REPORT_FILE_TYPES.ARCHIVE]} | ${archiveArtifacts}
${[REPORT_FILE_TYPES.TRACE]} | ${traceArtifacts}
${[REPORT_FILE_TYPES.METADATA]} | ${metadataArtifacts}
`(
'returns the expected artifacts given report types $reportTypes',
({ reportTypes, expectedArtifacts }) => {
expect(
extractSecurityReportArtifactsFromPipeline(
reportTypes,
securityReportPipelineDownloadPathsQueryResponse,
),
).toEqual(expectedArtifacts);
expect(extractFunc(reportTypes, response)).toEqual(expectedArtifacts);
},
);
});
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