Skip to content

Commit

Permalink
🤡 [open-formulieren/open-forms#4929] Fix payment plugin start mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Jan 17, 2025
1 parent 3d27813 commit 5f43008
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/api-mocks/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,6 @@ export const mockSubmissionProcessingStatusErrorGet = http.get(
})
);

export const mockSubmissionPaymentStartGet = http.post(`${BASE_URL}payment/:uuid/demo/start`, () =>
HttpResponse.json({data: {method: 'get', action: 'https://example.com'}})
);
export const mockSubmissionPaymentStartPost = (
data = {type: 'get', url: 'https://example.com', data: {}}
) => http.post(`${BASE_URL}payment/:uuid/demo/start`, () => HttpResponse.json(data));
6 changes: 4 additions & 2 deletions src/components/Form.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import mswServer from 'api-mocks/msw-server';
import {
mockSubmissionCompletePost,
mockSubmissionGet,
mockSubmissionPaymentStartPost,
mockSubmissionPost,
mockSubmissionProcessingStatusErrorGet,
mockSubmissionProcessingStatusGet,
Expand Down Expand Up @@ -235,7 +236,7 @@ test('Submitting the form with successful background processing', async () => {
expect(await screen.findByRole('heading', {name: 'Confirmation: OF-L337'})).toBeVisible();
});

test('Submitting form with payment requirement', async () => {
test.only('Submitting form with payment requirement', async () => {
const user = userEvent.setup({
advanceTimers: vi.advanceTimersByTime,
});
Expand All @@ -257,7 +258,8 @@ test('Submitting form with payment requirement', async () => {
mockSubmissionGet(submission),
mockSubmissionSummaryGet(),
mockSubmissionCompletePost(),
mockSubmissionProcessingStatusGet
mockSubmissionProcessingStatusGet,
mockSubmissionPaymentStartPost(null)
);

render(<Wrapper form={form} initialEntry={`/overzicht?submission_uuid=${submission.id}`} />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {expect, waitFor, within} from '@storybook/test';

import {BASE_URL} from 'api-mocks';
import {
mockSubmissionPaymentStartGet,
mockSubmissionPaymentStartPost,
mockSubmissionProcessingStatusGet,
} from 'api-mocks/submissions';
import {withSubmissionPollInfo} from 'story-utils/decorators';
Expand All @@ -21,7 +21,7 @@ export default {
},
parameters: {
msw: {
handlers: [mockSubmissionProcessingStatusGet, mockSubmissionPaymentStartGet],
handlers: [mockSubmissionProcessingStatusGet, mockSubmissionPaymentStartPost()],
},
},
};
Expand Down

0 comments on commit 5f43008

Please sign in to comment.