buildR2Storage registered nothing without R2_* env, so `pnpm dev` / generate:importmap in dev
wrote an importMap.js without S3ClientUploadHandler — committed, the production admin (R2 on)
rendered a blank page with no console error (hit vanstev.pl). The injected s3Storage is now
always registered (enabled: false without R2 → local disk); storage-s3 still adds its client
handler, so the import map is identical in every environment. ipal-audit flags an import map
without the handler.
R2_PUBLIC_URL alone (absolute, outside production) = read-only media: URLs from the media
domain, upload/delete refused with 403 — local dev against a production database without
bucket keys. ipalEnvRules allows it in development.
Cookie Settings (MongoDB): the 1.11.1 rename buttons.save → savePreferences lost the texts on
the first save; onInit copies the old value (all locales) when the new field is missing.
getConsentTexts read the old field as a string, Mongo returns the raw { pl, en } map.
Also: context.ipalSkipAutoFill (SKIP_AUTO_FILL) — save without meta / aiSummary auto-fill;
createPageRoute redirects the homepage under its own slug (homeAlias, default 'redirect');
ipal-audit: multi-line tsconfig exclude, numeronyms (a11y) not "numbered fields",
`${prefix}/${slug}` links and slugs typed into links detected, clearer panel-language message.
Docs: fallback-on-save in i18n.md, `pnpm up --latest` and the stale-token 401 in PROGRAMISTA §1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import type { FieldHook } from 'payload'
|
|
|
|
import { describe, expect, test } from 'vitest'
|
|
|
|
import { buildAutoFillMetaHook } from '../src/modules/seo/autoFillMeta.js'
|
|
import { buildSummaryField } from '../src/modules/seo/buildSummaryField.js'
|
|
import { SKIP_AUTO_FILL } from '../src/modules/seo/skipAutoFill.js'
|
|
|
|
const layout = [{ blockType: 'content', body: 'Rekrutujemy pracowników do pracy w Holandii od ponad dziesięciu lat.' }]
|
|
|
|
describe('context.ipalSkipAutoFill (1.12.2)', () => {
|
|
const summaryHook = (buildSummaryField() as { hooks: { beforeChange: FieldHook[] } }).hooks.beforeChange[0]
|
|
const metaHook = buildAutoFillMetaHook()
|
|
const run = (context: Record<string, unknown>) => ({
|
|
meta: (metaHook({ context, data: { layout, meta: {}, title: 'Kontakt' } } as never) as { meta: Record<string, unknown> }).meta,
|
|
summary: summaryHook({ context, data: { layout }, value: undefined } as never),
|
|
})
|
|
|
|
test('default: summary and meta are generated', () => {
|
|
const { meta, summary } = run({})
|
|
expect(summary).toMatch(/Rekrutujemy/)
|
|
expect(meta.title).toBe('Kontakt')
|
|
})
|
|
|
|
test('skipped: nothing generated', () => {
|
|
const { meta, summary } = run({ [SKIP_AUTO_FILL]: true })
|
|
expect(summary).toBeUndefined()
|
|
expect(meta).toEqual({})
|
|
})
|
|
})
|