Commit b5ac2897 authored by David Pisek's avatar David Pisek Committed by Frédéric Caplette

Use GraphQL-API to fetch sec training providers

This change switches from using mock, client-side resolvers for
retrieving security training providers, to fetching the data from
the actual GraphQL endpoint.
parent d8752364
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
TrainingProviderList, TrainingProviderList,
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
inject: ['projectPath'], inject: ['projectFullPath'],
props: { props: {
augmentedSecurityFeatures: { augmentedSecurityFeatures: {
type: Array, type: Array,
...@@ -107,14 +107,14 @@ export default { ...@@ -107,14 +107,14 @@ export default {
shouldShowAutoDevopsEnabledAlert() { shouldShowAutoDevopsEnabledAlert() {
return ( return (
this.autoDevopsEnabled && this.autoDevopsEnabled &&
!this.autoDevopsEnabledAlertDismissedProjects.includes(this.projectPath) !this.autoDevopsEnabledAlertDismissedProjects.includes(this.projectFullPath)
); );
}, },
}, },
methods: { methods: {
dismissAutoDevopsEnabledAlert() { dismissAutoDevopsEnabledAlert() {
const dismissedProjects = new Set(this.autoDevopsEnabledAlertDismissedProjects); const dismissedProjects = new Set(this.autoDevopsEnabledAlertDismissedProjects);
dismissedProjects.add(this.projectPath); dismissedProjects.add(this.projectFullPath);
this.autoDevopsEnabledAlertDismissedProjects = Array.from(dismissedProjects); this.autoDevopsEnabledAlertDismissedProjects = Array.from(dismissedProjects);
}, },
onError(message) { onError(message) {
......
...@@ -21,10 +21,18 @@ export default { ...@@ -21,10 +21,18 @@ export default {
GlLink, GlLink,
GlSkeletonLoader, GlSkeletonLoader,
}, },
inject: ['projectPath'], inject: ['projectFullPath'],
apollo: { apollo: {
securityTrainingProviders: { securityTrainingProviders: {
query: securityTrainingProvidersQuery, query: securityTrainingProvidersQuery,
variables() {
return {
fullPath: this.projectFullPath,
};
},
update({ project }) {
return project?.securityTrainingProviders;
},
error() { error() {
this.errorMessage = this.$options.i18n.providerQueryErrorMessage; this.errorMessage = this.$options.i18n.providerQueryErrorMessage;
}, },
...@@ -68,7 +76,7 @@ export default { ...@@ -68,7 +76,7 @@ export default {
variables: { variables: {
input: { input: {
enabledProviders: enabledProviderIds, enabledProviders: enabledProviderIds,
fullPath: this.projectPath, fullPath: this.projectFullPath,
}, },
}, },
}); });
......
query Query { query getSecurityTrainingProviders($fullPath: ID!) {
securityTrainingProviders @client { project(fullPath: $fullPath) {
name
id id
description securityTrainingProviders {
isEnabled name
url id
description
isEnabled
url
}
} }
} }
...@@ -19,7 +19,7 @@ export const initSecurityConfiguration = (el) => { ...@@ -19,7 +19,7 @@ export const initSecurityConfiguration = (el) => {
}); });
const { const {
projectPath, projectFullPath,
upgradePath, upgradePath,
features, features,
latestPipelinePath, latestPipelinePath,
...@@ -38,7 +38,7 @@ export const initSecurityConfiguration = (el) => { ...@@ -38,7 +38,7 @@ export const initSecurityConfiguration = (el) => {
el, el,
apolloProvider, apolloProvider,
provide: { provide: {
projectPath, projectFullPath,
upgradePath, upgradePath,
autoDevopsHelpPagePath, autoDevopsHelpPagePath,
autoDevopsPath, autoDevopsPath,
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
components: { components: {
GlButton, GlButton,
}, },
inject: ['projectPath'], inject: ['projectFullPath'],
props: { props: {
feature: { feature: {
type: Object, type: Object,
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
try { try {
const { mutationSettings } = this; const { mutationSettings } = this;
const { data } = await this.$apollo.mutate( const { data } = await this.$apollo.mutate(
mutationSettings.getMutationPayload(this.projectPath), mutationSettings.getMutationPayload(this.projectFullPath),
); );
const { errors, successPath } = data[mutationSettings.mutationId]; const { errors, successPath } = data[mutationSettings.mutationId];
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
- page_title _("Security Configuration") - page_title _("Security Configuration")
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
#js-security-configuration-static{ data: { project_path: @project.full_path, upgrade_path: security_upgrade_path } } #js-security-configuration-static{ data: { project_full_path: @project.full_path, upgrade_path: security_upgrade_path } }
<script> <script>
import { GlLink, GlIcon, GlSkeletonLoader } from '@gitlab/ui'; import { GlLink, GlIcon, GlSkeletonLoader } from '@gitlab/ui';
import * as Sentry from '@sentry/browser';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql'; import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -30,6 +31,7 @@ export default { ...@@ -30,6 +31,7 @@ export default {
GlSkeletonLoader, GlSkeletonLoader,
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
inject: ['projectFullPath'],
props: { props: {
identifiers: { identifiers: {
type: Array, type: Array,
...@@ -39,6 +41,17 @@ export default { ...@@ -39,6 +41,17 @@ export default {
apollo: { apollo: {
securityTrainingProviders: { securityTrainingProviders: {
query: securityTrainingProvidersQuery, query: securityTrainingProvidersQuery,
update({ project }) {
return project?.securityTrainingProviders;
},
error(e) {
Sentry.captureException(e);
},
variables() {
return {
fullPath: this.projectFullPath,
};
},
}, },
}, },
data() { data() {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
= render_ce 'projects/security/configuration/show' = render_ce 'projects/security/configuration/show'
- else - else
#js-security-configuration{ data: { **@configuration.to_html_data_attribute, #js-security-configuration{ data: { **@configuration.to_html_data_attribute,
project_path: @project.full_path, project_full_path: @project.full_path,
auto_fix_help_path: '/', auto_fix_help_path: '/',
toggle_autofix_setting_endpoint: 'configuration/auto_fix', toggle_autofix_setting_endpoint: 'configuration/auto_fix',
container_scanning_help_path: help_page_path('user/application_security/container_scanning/index'), container_scanning_help_path: help_page_path('user/application_security/container_scanning/index'),
......
...@@ -24,6 +24,9 @@ describe('Vulnerability Details', () => { ...@@ -24,6 +24,9 @@ describe('Vulnerability Details', () => {
}; };
wrapper = mountFn(VulnerabilityDetails, { wrapper = mountFn(VulnerabilityDetails, {
propsData, propsData,
provide: {
projectFullPath: 'namespace/project',
},
}); });
}; };
const createShallowWrapper = (...args) => createWrapper(...args, { mountFn: shallowMount }); const createShallowWrapper = (...args) => createWrapper(...args, { mountFn: shallowMount });
......
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import * as Sentry from '@sentry/browser';
import { GlLink, GlIcon, GlSkeletonLoader } from '@gitlab/ui'; import { GlLink, GlIcon, GlSkeletonLoader } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
...@@ -9,11 +10,12 @@ import VulnerabilityTraining, { ...@@ -9,11 +10,12 @@ import VulnerabilityTraining, {
i18n, i18n,
mockProvider, mockProvider,
} from 'ee/vulnerabilities/components/vulnerability_training.vue'; } from 'ee/vulnerabilities/components/vulnerability_training.vue';
import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { SUPPORTED_IDENTIFIER_TYPES } from 'ee/vulnerabilities/constants'; import { SUPPORTED_IDENTIFIER_TYPES } from 'ee/vulnerabilities/constants';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { createMockResolvers } from 'jest/security_configuration/mock_data'; import { securityTrainingProvidersResponse } from 'jest/security_configuration/mock_data';
const defaultProps = { const defaultProps = {
identifiers: [{ externalType: SUPPORTED_IDENTIFIER_TYPES.cwe }, { externalType: 'cve' }], identifiers: [{ externalType: SUPPORTED_IDENTIFIER_TYPES.cwe }, { externalType: 'cve' }],
...@@ -28,8 +30,13 @@ describe('VulnerabilityTraining component', () => { ...@@ -28,8 +30,13 @@ describe('VulnerabilityTraining component', () => {
let apolloProvider; let apolloProvider;
let mock; let mock;
const createApolloProvider = ({ resolvers } = {}) => { const createApolloProvider = ({ queryHandler } = {}) => {
apolloProvider = createMockApollo([], createMockResolvers({ resolvers })); apolloProvider = createMockApollo([
[
securityTrainingProvidersQuery,
queryHandler || jest.fn().mockResolvedValue(securityTrainingProvidersResponse),
],
]);
}; };
const createComponent = (props = {}, { secureVulnerabilityTraining = true } = {}) => { const createComponent = (props = {}, { secureVulnerabilityTraining = true } = {}) => {
...@@ -40,6 +47,7 @@ describe('VulnerabilityTraining component', () => { ...@@ -40,6 +47,7 @@ describe('VulnerabilityTraining component', () => {
}, },
apolloProvider, apolloProvider,
provide: { provide: {
projectFullPath: 'namespace/project',
glFeatures: { glFeatures: {
secureVulnerabilityTraining, secureVulnerabilityTraining,
}, },
...@@ -70,79 +78,101 @@ describe('VulnerabilityTraining component', () => { ...@@ -70,79 +78,101 @@ describe('VulnerabilityTraining component', () => {
const findTrainingItemLink = () => wrapper.findComponent(GlLink); const findTrainingItemLink = () => wrapper.findComponent(GlLink);
const findTrainingItemLinkIcon = () => wrapper.findComponent(GlIcon); const findTrainingItemLinkIcon = () => wrapper.findComponent(GlIcon);
describe('basic structure', () => { describe('with the query being successful', () => {
it('displays the title', async () => { beforeEach(() => {
createComponent(); createApolloProvider();
await waitForQueryToBeLoaded();
expect(findTitle().text()).toBe(i18n.trainingTitle);
}); });
it('displays the description', async () => { describe('basic structure', () => {
createComponent(); it('displays the title', async () => {
await waitForQueryToBeLoaded(); createComponent();
expect(findDescription().text()).toBe(i18n.trainingDescription); await waitForQueryToBeLoaded();
}); expect(findTitle().text()).toBe(i18n.trainingTitle);
});
it('does not render component when there are no identifiers', () => { it('displays the description', async () => {
createComponent({ identifiers: [] }); createComponent();
expect(wrapper.html()).toBeFalsy(); await waitForQueryToBeLoaded();
}); expect(findDescription().text()).toBe(i18n.trainingDescription);
});
it('does not render component when there are no securityTrainingProviders', () => { it('does not render component when there are no identifiers', () => {
createComponent(); createComponent({ identifiers: [] });
expect(wrapper.html()).toBeFalsy(); expect(wrapper.html()).toBeFalsy();
}); });
});
describe('training availability message', () => { it('does not render component when there are no securityTrainingProviders', () => {
it('displays the message', async () => { createComponent();
createComponent({ expect(wrapper.html()).toBeFalsy();
identifiers: [{ externalType: 'not supported identifier' }],
}); });
await waitForQueryToBeLoaded();
expect(findUnavailableMessage().text()).toBe(i18n.trainingUnavailable);
}); });
it.each` describe('training availability message', () => {
identifier | exists it('displays the message', async () => {
${'not supported identifier'} | ${true} createComponent({
${SUPPORTED_IDENTIFIER_TYPES.cwe.toUpperCase()} | ${false} identifiers: [{ externalType: 'not supported identifier' }],
${SUPPORTED_IDENTIFIER_TYPES.cwe.toLowerCase()} | ${false} });
`('sets it to "$exists" for "$identifier"', async ({ identifier, exists }) => { await waitForQueryToBeLoaded();
await mockTrainingSuccess(); expect(findUnavailableMessage().text()).toBe(i18n.trainingUnavailable);
createComponent({ identifiers: [{ externalType: identifier }] }); });
await waitForQueryToBeLoaded();
expect(findUnavailableMessage().exists()).toBe(exists); it.each`
identifier | exists
${'not supported identifier'} | ${true}
${SUPPORTED_IDENTIFIER_TYPES.cwe.toUpperCase()} | ${false}
${SUPPORTED_IDENTIFIER_TYPES.cwe.toLowerCase()} | ${false}
`('sets it to "$exists" for "$identifier"', async ({ identifier, exists }) => {
await mockTrainingSuccess();
createComponent({ identifiers: [{ externalType: identifier }] });
await waitForQueryToBeLoaded();
expect(findUnavailableMessage().exists()).toBe(exists);
});
}); });
});
describe('training item', () => { describe('training item', () => {
it('displays GlSkeletonLoader when loading', async () => { it('displays GlSkeletonLoader when loading', async () => {
await delayTrainingResponse(); await delayTrainingResponse();
createComponent(); createComponent();
await waitForQueryToBeLoaded(); await waitForQueryToBeLoaded();
expect(wrapper.findComponent(GlSkeletonLoader).exists()).toBe(true);
});
it('displays training item information', async () => {
await mockTrainingSuccess();
createComponent();
await waitForQueryToBeLoaded();
expect(wrapper.findComponent(GlSkeletonLoader).exists()).toBe(true); expect(findTrainingItemName().exists()).toBe(true);
expect(findTrainingItemLink().attributes('href')).toBe(mockSuccessTrainingUrl);
expect(findTrainingItemLinkIcon().attributes('name')).toBe('external-link');
});
it('does not display training item information for non supported identifier', async () => {
await mockTrainingSuccess();
createComponent({ identifiers: [{ externalType: 'not supported identifier' }] });
await waitForQueryToBeLoaded();
expect(findTrainingItemName().exists()).toBe(false);
expect(findTrainingItemLink().exists()).toBe(false);
expect(findTrainingItemLinkIcon().exists()).toBe(false);
});
}); });
});
it('displays training item information', async () => { describe('with the query resulting in an error', () => {
await mockTrainingSuccess(); beforeEach(() => {
jest.spyOn(Sentry, 'captureException');
createApolloProvider({ queryHandler: jest.fn().mockResolvedValue(new Error()) });
createComponent(); createComponent();
await waitForQueryToBeLoaded();
expect(findTrainingItemName().exists()).toBe(true);
expect(findTrainingItemLink().attributes('href')).toBe(mockSuccessTrainingUrl);
expect(findTrainingItemLinkIcon().attributes('name')).toBe('external-link');
}); });
it('does not display training item information for non supported identifier', async () => { it('reports the error to sentry', async () => {
await mockTrainingSuccess(); expect(Sentry.captureException).not.toHaveBeenCalled();
createComponent({ identifiers: [{ externalType: 'not supported identifier' }] });
await waitForQueryToBeLoaded(); await waitForQueryToBeLoaded();
expect(findTrainingItemName().exists()).toBe(false); expect(Sentry.captureException).toHaveBeenCalled();
expect(findTrainingItemLink().exists()).toBe(false);
expect(findTrainingItemLinkIcon().exists()).toBe(false);
}); });
}); });
......
...@@ -32,7 +32,7 @@ const upgradePath = '/upgrade'; ...@@ -32,7 +32,7 @@ const upgradePath = '/upgrade';
const autoDevopsHelpPagePath = '/autoDevopsHelpPagePath'; const autoDevopsHelpPagePath = '/autoDevopsHelpPagePath';
const autoDevopsPath = '/autoDevopsPath'; const autoDevopsPath = '/autoDevopsPath';
const gitlabCiHistoryPath = 'test/historyPath'; const gitlabCiHistoryPath = 'test/historyPath';
const projectPath = 'namespace/project'; const projectFullPath = 'namespace/project';
useLocalStorageSpy(); useLocalStorageSpy();
...@@ -54,7 +54,7 @@ describe('App component', () => { ...@@ -54,7 +54,7 @@ describe('App component', () => {
upgradePath, upgradePath,
autoDevopsHelpPagePath, autoDevopsHelpPagePath,
autoDevopsPath, autoDevopsPath,
projectPath, projectFullPath,
glFeatures: { glFeatures: {
secureVulnerabilityTraining, secureVulnerabilityTraining,
}, },
...@@ -274,11 +274,11 @@ describe('App component', () => { ...@@ -274,11 +274,11 @@ describe('App component', () => {
describe('Auto DevOps enabled alert', () => { describe('Auto DevOps enabled alert', () => {
describe.each` describe.each`
context | autoDevopsEnabled | localStorageValue | shouldRender context | autoDevopsEnabled | localStorageValue | shouldRender
${'enabled'} | ${true} | ${null} | ${true} ${'enabled'} | ${true} | ${null} | ${true}
${'enabled, alert dismissed on other project'} | ${true} | ${['foo/bar']} | ${true} ${'enabled, alert dismissed on other project'} | ${true} | ${['foo/bar']} | ${true}
${'enabled, alert dismissed on this project'} | ${true} | ${[projectPath]} | ${false} ${'enabled, alert dismissed on this project'} | ${true} | ${[projectFullPath]} | ${false}
${'not enabled'} | ${false} | ${null} | ${false} ${'not enabled'} | ${false} | ${null} | ${false}
`('given Auto DevOps is $context', ({ autoDevopsEnabled, localStorageValue, shouldRender }) => { `('given Auto DevOps is $context', ({ autoDevopsEnabled, localStorageValue, shouldRender }) => {
beforeEach(() => { beforeEach(() => {
if (localStorageValue !== null) { if (localStorageValue !== null) {
...@@ -302,11 +302,11 @@ describe('App component', () => { ...@@ -302,11 +302,11 @@ describe('App component', () => {
describe('dismissing', () => { describe('dismissing', () => {
describe.each` describe.each`
dismissedProjects | expectedWrittenValue dismissedProjects | expectedWrittenValue
${null} | ${[projectPath]} ${null} | ${[projectFullPath]}
${[]} | ${[projectPath]} ${[]} | ${[projectFullPath]}
${['foo/bar']} | ${['foo/bar', projectPath]} ${['foo/bar']} | ${['foo/bar', projectFullPath]}
${[projectPath]} | ${[projectPath]} ${[projectFullPath]} | ${[projectFullPath]}
`( `(
'given dismissed projects $dismissedProjects', 'given dismissed projects $dismissedProjects',
({ dismissedProjects, expectedWrittenValue }) => { ({ dismissedProjects, expectedWrittenValue }) => {
......
...@@ -4,11 +4,12 @@ import Vue from 'vue'; ...@@ -4,11 +4,12 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import TrainingProviderList from '~/security_configuration/components/training_provider_list.vue'; import TrainingProviderList from '~/security_configuration/components/training_provider_list.vue';
import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql';
import configureSecurityTrainingProvidersMutation from '~/security_configuration/graphql/configure_security_training_providers.mutation.graphql'; import configureSecurityTrainingProvidersMutation from '~/security_configuration/graphql/configure_security_training_providers.mutation.graphql';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { import {
securityTrainingProviders, securityTrainingProviders,
createMockResolvers, securityTrainingProvidersResponse,
testProjectPath, testProjectPath,
textProviderIds, textProviderIds,
} from '../mock_data'; } from '../mock_data';
...@@ -19,14 +20,19 @@ describe('TrainingProviderList component', () => { ...@@ -19,14 +20,19 @@ describe('TrainingProviderList component', () => {
let wrapper; let wrapper;
let apolloProvider; let apolloProvider;
const createApolloProvider = ({ resolvers } = {}) => { const createApolloProvider = ({ resolvers, queryHandler } = {}) => {
apolloProvider = createMockApollo([], createMockResolvers({ resolvers })); const defaultQueryHandler = jest.fn().mockResolvedValue(securityTrainingProvidersResponse);
apolloProvider = createMockApollo(
[[securityTrainingProvidersQuery, queryHandler || defaultQueryHandler]],
resolvers,
);
}; };
const createComponent = () => { const createComponent = () => {
wrapper = shallowMount(TrainingProviderList, { wrapper = shallowMount(TrainingProviderList, {
provide: { provide: {
projectPath: testProjectPath, projectFullPath: testProjectPath,
}, },
apolloProvider, apolloProvider,
}); });
...@@ -49,20 +55,29 @@ describe('TrainingProviderList component', () => { ...@@ -49,20 +55,29 @@ describe('TrainingProviderList component', () => {
apolloProvider = null; apolloProvider = null;
}); });
describe('with a successful response', () => { describe('when loading', () => {
beforeEach(() => { beforeEach(() => {
createApolloProvider(); const pendingHandler = () => new Promise(() => {});
createApolloProvider({
queryHandler: pendingHandler,
});
createComponent(); createComponent();
}); });
describe('when loading', () => { it('shows the loader', () => {
it('shows the loader', () => { expect(findLoader().exists()).toBe(true);
expect(findLoader().exists()).toBe(true); });
});
it('does not show the cards', () => { it('does not show the cards', () => {
expect(findCards().exists()).toBe(false); expect(findCards().exists()).toBe(false);
}); });
});
describe('with a successful response', () => {
beforeEach(() => {
createApolloProvider();
createComponent();
}); });
describe('basic structure', () => { describe('basic structure', () => {
...@@ -142,11 +157,7 @@ describe('TrainingProviderList component', () => { ...@@ -142,11 +157,7 @@ describe('TrainingProviderList component', () => {
describe('when fetching training providers', () => { describe('when fetching training providers', () => {
beforeEach(async () => { beforeEach(async () => {
createApolloProvider({ createApolloProvider({
resolvers: { queryHandler: jest.fn().mockReturnValue(new Error()),
Query: {
securityTrainingProviders: jest.fn().mockReturnValue(new Error()),
},
},
}); });
createComponent(); createComponent();
......
...@@ -21,19 +21,9 @@ export const securityTrainingProviders = [ ...@@ -21,19 +21,9 @@ export const securityTrainingProviders = [
export const securityTrainingProvidersResponse = { export const securityTrainingProvidersResponse = {
data: { data: {
securityTrainingProviders, project: {
}, id: 1,
}; securityTrainingProviders,
const defaultMockResolvers = {
Query: {
securityTrainingProviders() {
return securityTrainingProviders;
}, },
}, },
}; };
export const createMockResolvers = ({ resolvers: customMockResolvers = {} } = {}) => ({
...defaultMockResolvers,
...customMockResolvers,
});
...@@ -16,7 +16,7 @@ jest.mock('~/lib/utils/url_utility'); ...@@ -16,7 +16,7 @@ jest.mock('~/lib/utils/url_utility');
Vue.use(VueApollo); Vue.use(VueApollo);
const projectPath = 'namespace/project'; const projectFullPath = 'namespace/project';
describe('ManageViaMr component', () => { describe('ManageViaMr component', () => {
let wrapper; let wrapper;
...@@ -40,7 +40,7 @@ describe('ManageViaMr component', () => { ...@@ -40,7 +40,7 @@ describe('ManageViaMr component', () => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
mount(ManageViaMr, { mount(ManageViaMr, {
provide: { provide: {
projectPath, projectFullPath,
}, },
propsData: { propsData: {
feature: { feature: {
...@@ -65,7 +65,7 @@ describe('ManageViaMr component', () => { ...@@ -65,7 +65,7 @@ describe('ManageViaMr component', () => {
// the ones available in the current test context. // the ones available in the current test context.
const supportedReportTypes = Object.entries(featureToMutationMap).map( const supportedReportTypes = Object.entries(featureToMutationMap).map(
([featureType, { getMutationPayload, mutationId }]) => { ([featureType, { getMutationPayload, mutationId }]) => {
const { mutation, variables: mutationVariables } = getMutationPayload(projectPath); const { mutation, variables: mutationVariables } = getMutationPayload(projectFullPath);
return [humanize(featureType), featureType, mutation, mutationId, mutationVariables]; return [humanize(featureType), featureType, mutation, mutationId, mutationVariables];
}, },
); );
......
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