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');
Vue.use(VueApollo);
const projectPath = 'namespace/project';
describe('ManageViaMr component', () => {
let wrapper;
......@@ -29,7 +31,7 @@ describe('ManageViaMr component', () => {
${'DEPENDENCY_SCANNING'} | ${REPORT_TYPE_SECRET_DETECTION} | ${configureSecretDetectionMutation} | ${'configureSecretDetection'}
`('$featureType', ({ featureName, mutation, featureType, mutationId }) => {
const buildConfigureSecurityFeatureMock = buildConfigureSecurityFeatureMockFactory(mutationId);
const successHandler = async () => buildConfigureSecurityFeatureMock();
const successHandler = jest.fn(async () => buildConfigureSecurityFeatureMock());
const noSuccessPathHandler = async () =>
buildConfigureSecurityFeatureMock({
successPath: '',
......@@ -51,7 +53,7 @@ describe('ManageViaMr component', () => {
mount(ManageViaMr, {
apolloProvider: mockApollo,
provide: {
projectPath: 'testProjectPath',
projectPath,
},
propsData: {
feature: {
......@@ -88,6 +90,17 @@ describe('ManageViaMr component', () => {
it('it does render a button', () => {
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', () => {
......
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