GEO / SEO
- collectSiteIndex: one list of public docs per locale (pages + archive
entries) on sitemap rules; llms.txt/llms-full and MCP list_pages now include
blog/content entries and every language. Fixes hard-coded "## Strony" heading
and homepage not collapsing to the locale root in llms.txt.
- Markdown frontmatter: canonical url + updated date.
- Metadata: X/Twitter card, OG image width/height/alt, og:type article with
published/modified times for entries.
- Fix: Site Settings "defaultShareImage" was never used — now the OG fallback.
- getPageJsonLd (createContentHelpers): WebPage/CollectionPage/BlogPosting,
BreadcrumbList from the real route, FAQPage via a project mapper.
- IndexNow (opt-in ipalKit({ indexNow: true })): submit published URLs in all
languages, key generated in Site Integrations or INDEXNOW_KEY, key route.
- sameAs profiles in Site Settings + sameAsUrls(); sitemap <image:image>.
From project reports
- Fix: package exports were missing ./env and ./fluid.css although the docs
import them (TS2307); regression test checks every documented subpath.
- Fix: plugins run before Payload adds its default users collection, so roles
and 2FA had nothing to attach to — ipalKit injects an auth collection when
the project has none (project's own one wins). Audit no longer errors on it.
- createMarkdownRoute, createSubmitAction (/server, headers injected).
- formatOpeningHours (PL/EN/DE text → schema.org), used by
buildLocalBusinessJsonLd, which also takes a schema.org `type`.
- buildNavigationJsonLd straight from the header global.
- buildCsp googleMaps: full Maps JS API domain set; values de-duplicated.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
41 lines
1.8 KiB
TypeScript
41 lines
1.8 KiB
TypeScript
import { afterEach, describe, expect, test, vi } from 'vitest'
|
|
|
|
import { createSubmitAction } from '../src/modules/forms/createSubmitAction.js'
|
|
import { fakePayload } from './helpers.js'
|
|
|
|
vi.mock('server-only', () => ({}))
|
|
|
|
const forms = { contact: { fields: [{ name: 'name', blockType: 'text', required: true }] } }
|
|
|
|
describe('createSubmitAction', () => {
|
|
afterEach(() => vi.restoreAllMocks())
|
|
|
|
const make = (ip: string) => {
|
|
const { create, payload } = fakePayload({ forms })
|
|
;(payload as unknown as { findGlobal: unknown }).findGlobal = vi.fn(async ({ slug }: { slug: string }) =>
|
|
slug === 'notifications' ? { form: { success: 'Dzięki!', validation: 'Uzupełnij pola' } } : {},
|
|
)
|
|
const sendForm = createSubmitAction({ getCachedPayload: async () => payload, headers: () => new Headers({ 'x-real-ip': ip }) })
|
|
return { create, sendForm }
|
|
}
|
|
|
|
test('valid submission → stored, message from Notifications', async () => {
|
|
const { create, sendForm } = make('10.8.0.1')
|
|
expect(await sendForm('contact', 'pl', { name: 'Ala' })).toEqual({ message: 'Dzięki!', success: true })
|
|
expect(create).toHaveBeenCalledOnce()
|
|
})
|
|
|
|
test('honeypot → fake success, nothing stored; field is stripped otherwise', async () => {
|
|
const { create, sendForm } = make('10.8.0.2')
|
|
expect((await sendForm('contact', 'pl', { name: 'x', company_url: 'http://spam' })).success).toBe(true)
|
|
expect(create).not.toHaveBeenCalled()
|
|
expect((await sendForm('contact', 'pl', { name: 'Ala', company_url: '' })).success).toBe(true)
|
|
expect(create).toHaveBeenCalledOnce()
|
|
})
|
|
|
|
test('failure carries reason and field for the renderer', async () => {
|
|
const { sendForm } = make('10.8.0.3')
|
|
expect(await sendForm('contact', 'pl', {})).toMatchObject({ field: 'name', reason: 'validation', success: false })
|
|
})
|
|
})
|