import type { PayloadRequest } from 'payload' import { describe, expect, test, vi } from 'vitest' import type { BuilderField } from '../src/modules/forms/builderTypes.js' import { buildEmailLayoutHook, buildSubmissionSummary, renderSummaryHtml, replaceSubmissionTable, wrapEmailHtml } from '../src/modules/forms/emailLayout.js' import { submitForm } from '../src/modules/forms/submitForm.js' import { fakePayload } from './helpers.js' vi.mock('server-only', () => ({})) const fields: BuilderField[] = [ { blockType: 'step', title: 'O firmie' }, { blockType: 'message' }, { name: 'company', blockType: 'text', label: 'Nazwa firmy' }, { name: 'website', blockType: 'text', label: 'Strona' }, { name: 'areas', blockType: 'checkboxGroup', label: 'Obszary', options: [{ label: 'Strony internetowe', value: 'web' }, { label: 'IT', value: 'it' }] }, { name: 'size', blockType: 'radio', label: 'Wielkość', options: [{ label: 'Do 10', value: '1-9' }] }, { name: 'consent', blockType: 'checkbox', label: 'Zgoda RODO' }, { blockType: 'step', title: 'IT' }, { name: 'it_scope', blockType: 'textarea', label: 'Zakres' }, ] const stored = [ { field: 'company', value: 'Acme