diff --git a/src/components/FormStart/tests.spec.js b/src/components/FormStart/tests.spec.js index b648ecbba..f837d88e3 100644 --- a/src/components/FormStart/tests.spec.js +++ b/src/components/FormStart/tests.spec.js @@ -10,7 +10,7 @@ import {buildSubmission} from 'api-mocks'; import useQuery from 'hooks/useQuery'; import FormStart from '.'; -import {testForm} from './fixtures'; +import {testForm, testLoginForm} from './fixtures'; jest.mock('hooks/useQuery'); let scrollIntoViewMock = jest.fn(); @@ -116,3 +116,26 @@ it('Form start page does not show login buttons if an active submission is prese expect(screen.queryByRole('button', {name: 'Continue existing submission'})).toBeInTheDocument(); expect(screen.queryByRole('button', {name: 'Abort submission'})).toBeInTheDocument(); }); + +it('Form start page with initial_data_reference', () => { + useQuery.mockReturnValue(new URLSearchParams()); + const onFormStart = jest.fn(); + const onDestroySession = jest.fn(); + + renderTest( + + + , + container + ); + const loginLink = screen.getByRole('link', {name: 'Login with DigiD'}); + expect(loginLink).toHaveAttribute( + 'href', + 'https://openforms.nl/auth/form-name/digid/start?initial_data_reference=1234&next=http%3A%2F%2Flocalhost%2F%3F_start%3D1' + ); +}); diff --git a/src/components/IntroductionPage/IntroductionPage.stories.js b/src/components/IntroductionPage/IntroductionPage.stories.js index 75426d914..1df91fcc2 100644 --- a/src/components/IntroductionPage/IntroductionPage.stories.js +++ b/src/components/IntroductionPage/IntroductionPage.stories.js @@ -1,3 +1,4 @@ +import {expect, userEvent, within} from '@storybook/test'; import {withRouter} from 'storybook-addon-remix-react-router'; import {buildForm} from 'api-mocks'; @@ -48,3 +49,15 @@ export default { export const Default = { name: 'IntroductionPage', }; + +export const IntroductionPageWithInitialDataReference = { + name: 'IntroductionPage with initial data reference', + args: { + extraParams: {initial_data_reference: '1234'}, + }, + play: async ({canvasElement}) => { + const canvas = within(canvasElement); + const continueLink = canvas.getByRole('link', {name: 'Continue'}); + await expect(continueLink).toHaveAttribute('href', '/startpagina?initial_data_reference=1234'); + }, +};