submitForm reads forms.consentFieldName from ipalKit options

The option was typed but never read. An explicit argument still wins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 17:35:08 +02:00
co-authored by Claude Opus 5.5
parent 38c1d9215e
commit 4585e0fc69
2 changed files with 18 additions and 2 deletions
+12
View File
@@ -132,6 +132,18 @@ describe('submitForm — other gates', () => {
})
})
test('ipalKit forms.consentFieldName (payload.config.custom) names the consent field', async () => {
const { payload } = fakePayload({ forms: { f: { fields: [{ name: 'zgoda', blockType: 'checkbox' }] } } })
Object.assign(payload, { config: { custom: { ipal: { consentFieldName: 'zgoda' } } } })
expect(await submitForm({ data: { zgoda: false }, formId: 'f', ip: nextIp(), payload })).toEqual({
field: 'zgoda',
reason: 'consent',
success: false,
})
// an explicit argument still wins
expect((await submitForm({ consentFieldName: 'other', data: { zgoda: false }, formId: 'f', ip: nextIp(), payload })).success).toBe(true)
})
test('consent must be checked', async () => {
const { payload } = fakePayload({ forms })
expect(await submitForm({ data: { ...data, consent: false }, formId: 'contact', ip: nextIp(), payload })).toEqual({