Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [open-formulieren/open-forms#4827] Do not add initial_data_ref if empty #733

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/FormStart/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
);
}

const extraNextParams = initialDataReference
? {initial_data_reference: initialDataReference}

Check warning on line 109 in src/components/FormStart/index.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/FormStart/index.jsx#L109

Added line #L109 was not covered by tests
: {};

return (
<LiteralsProvider literals={form.literals}>
<Card title={form.name}>
Expand All @@ -121,11 +125,7 @@
isAuthenticated={isAuthenticated}
/>
) : (
<LoginOptions
form={form}
onFormStart={onFormStart}
extraNextParams={{initial_data_reference: initialDataReference}}
/>
<LoginOptions form={form} onFormStart={onFormStart} extraNextParams={extraNextParams} />
)}
</Card>
</LiteralsProvider>
Expand Down
23 changes: 23 additions & 0 deletions src/components/FormStart/tests.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,26 @@ it('Form start page with initial_data_reference', async () => {
'https://openforms.nl/auth/form-name/digid/start?next=http%3A%2F%2Flocalhost%2F%3F_start%3D1%26initial_data_reference%3D1234'
);
});

it('Form start page without initial_data_reference', async () => {
useQuery.mockReturnValue(new URLSearchParams());
const onFormStart = jest.fn();
const onDestroySession = jest.fn();

render(
<Wrap>
<FormStart
form={testLoginForm}
onFormStart={onFormStart}
onDestroySession={onDestroySession}
initialDataReference={null}
/>
</Wrap>
);

const loginLink = await screen.findByRole('link', {name: 'Login with DigiD'});
expect(loginLink).toHaveAttribute(
'href',
'https://openforms.nl/auth/form-name/digid/start?next=http%3A%2F%2Flocalhost%2F%3F_start%3D1'
);
});