Commit 3a108f26 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '234014-refactor-on-demand-scans' into 'master'

Replace static props with provide/inject

See merge request gitlab-org/gitlab!68760
parents 15c42390 b875ac69
......@@ -98,23 +98,8 @@ export default {
SITE_PROFILES_QUERY,
),
},
inject: {
dastSiteValidationDocsPath: {
default: '',
},
profilesLibraryPath: {
default: '',
},
},
inject: ['projectPath', 'helpPagePath', 'dastSiteValidationDocsPath', 'profilesLibraryPath'],
props: {
helpPagePath: {
type: String,
required: true,
},
projectPath: {
type: String,
required: true,
},
defaultBranch: {
type: String,
required: false,
......
......@@ -26,6 +26,8 @@ export default () => {
el,
apolloProvider,
provide: {
projectPath,
helpPagePath,
profilesLibraryPath,
scannerProfilesLibraryPath,
siteProfilesLibraryPath,
......@@ -36,8 +38,6 @@ export default () => {
render(h) {
return h(OnDemandScansForm, {
props: {
helpPagePath,
projectPath,
defaultBranch,
dastScan: dastScan ? convertObjectPropsToCamelCase(JSON.parse(dastScan)) : null,
},
......
......@@ -21,6 +21,7 @@ import * as responses from '../mocks/apollo_mocks';
import { scannerProfiles, siteProfiles } from '../mocks/mock_data';
const helpPagePath = '/application_security/dast/index#on-demand-scans';
const dastSiteValidationDocsPath = '/application_security/dast/index#dast-site-validation';
const projectPath = 'group/project';
const defaultBranch = 'main';
const selectedBranch = 'some-other-branch';
......@@ -29,13 +30,6 @@ const scannerProfilesLibraryPath = '/security/configuration/dast_scans#scanner-p
const siteProfilesLibraryPath = '/security/configuration/dast_scans#site-profiles';
const newScannerProfilePath = '/security/configuration/dast_scans/dast_scanner_profile/new';
const newSiteProfilePath = `/${projectPath}/-/security/configuration/dast_scans`;
const defaultProps = {
helpPagePath,
projectPath,
defaultBranch,
};
const pipelineUrl = `/${projectPath}/pipelines/123`;
const editPath = `/${projectPath}/on_demand_scans/1/edit`;
const [passiveScannerProfile, activeScannerProfile] = scannerProfiles;
......@@ -154,14 +148,19 @@ describe('OnDemandScansForm', () => {
merge(
{},
{
propsData: defaultProps,
propsData: {
defaultBranch,
},
mocks: defaultMocks,
provide: {
projectPath,
helpPagePath,
profilesLibraryPath,
scannerProfilesLibraryPath,
siteProfilesLibraryPath,
newScannerProfilePath,
newSiteProfilePath,
dastSiteValidationDocsPath,
},
stubs: {
GlFormInput: GlFormInputStub,
......
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