Consent version test: no direct buildConfig import (testConfig guard)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 11:07:46 +01:00
co-authored by Claude Opus 5.5
parent 27ddbc3b41
commit 35bc4f094a
-2
View File
@@ -96,10 +96,8 @@ describe('cookieSettings: { allowLowerPolicyVersion: true } keeps the old behavi
})
test('iapl() passes the option through', async () => {
const { buildConfig } = await import('payload')
const { policyVersionNeverDown } = await import('../src/globals/CookieSettings/fields.js')
const config = await iapl({ cookieSettings: { allowLowerPolicyVersion: true }, i18n: { defaultLocale: 'en', locales: [{ code: 'en', label: 'English' }] }, mail: { relay: false }, twoFactor: false })({ collections: [], secret: 'x' } as never)
void buildConfig
const g = config.globals!.find((x) => x.slug === 'cookie-settings') as { fields: { hooks?: { beforeValidate?: unknown[] }; name?: string }[] }
expect(g.fields.find((f) => f.name === 'policyVersion')?.hooks?.beforeValidate ?? []).not.toContain(policyVersionNeverDown)
})