Commit 70f764e9 authored by Mark Florian's avatar Mark Florian

Merge branch '327122-manage-via-mr-test-mutation-payload' into 'master'

Test mutation payload in ManageViaMr

See merge request gitlab-org/gitlab!58936
parents c7e05e5a 139e730a
...@@ -19,6 +19,8 @@ jest.mock('~/lib/utils/url_utility'); ...@@ -19,6 +19,8 @@ jest.mock('~/lib/utils/url_utility');
Vue.use(VueApollo); Vue.use(VueApollo);
const projectPath = 'namespace/project';
describe('ManageViaMr component', () => { describe('ManageViaMr component', () => {
let wrapper; let wrapper;
...@@ -29,7 +31,7 @@ describe('ManageViaMr component', () => { ...@@ -29,7 +31,7 @@ describe('ManageViaMr component', () => {
${'DEPENDENCY_SCANNING'} | ${REPORT_TYPE_SECRET_DETECTION} | ${configureSecretDetectionMutation} | ${'configureSecretDetection'} ${'DEPENDENCY_SCANNING'} | ${REPORT_TYPE_SECRET_DETECTION} | ${configureSecretDetectionMutation} | ${'configureSecretDetection'}
`('$featureType', ({ featureName, mutation, featureType, mutationId }) => { `('$featureType', ({ featureName, mutation, featureType, mutationId }) => {
const buildConfigureSecurityFeatureMock = buildConfigureSecurityFeatureMockFactory(mutationId); const buildConfigureSecurityFeatureMock = buildConfigureSecurityFeatureMockFactory(mutationId);
const successHandler = async () => buildConfigureSecurityFeatureMock(); const successHandler = jest.fn(async () => buildConfigureSecurityFeatureMock());
const noSuccessPathHandler = async () => const noSuccessPathHandler = async () =>
buildConfigureSecurityFeatureMock({ buildConfigureSecurityFeatureMock({
successPath: '', successPath: '',
...@@ -51,7 +53,7 @@ describe('ManageViaMr component', () => { ...@@ -51,7 +53,7 @@ describe('ManageViaMr component', () => {
mount(ManageViaMr, { mount(ManageViaMr, {
apolloProvider: mockApollo, apolloProvider: mockApollo,
provide: { provide: {
projectPath: 'testProjectPath', projectPath,
}, },
propsData: { propsData: {
feature: { feature: {
...@@ -88,6 +90,17 @@ describe('ManageViaMr component', () => { ...@@ -88,6 +90,17 @@ describe('ManageViaMr component', () => {
it('it does render a button', () => { it('it does render a button', () => {
expect(findButton().exists()).toBe(true); expect(findButton().exists()).toBe(true);
}); });
it('clicking on the button triggers the configure mutation', () => {
findButton().trigger('click');
expect(successHandler).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledWith({
input: {
projectPath,
},
});
});
}); });
describe('given a pending response', () => { describe('given a pending response', () => {
......
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