PROGRAMISTA §6 rows 83–87 now 1.18.0 (1.17.2 was never released alone) and new rows 88–94; iapl-upgrade blocks for speed and growth and for drafts in related documents, the 1.17.2 blocks as "→ 1.18.0 (from 1.17.2)"; every "since 1.17.2" in docs, comments and tests reads 1.18.0; reference skills, AGENTS.md and the reference index on 1.18.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
1.2 KiB
TypeScript
23 lines
1.2 KiB
TypeScript
/** adminSameOrigin: false leaves the origin check out (adminSameOriginSuite.ts). */
|
|
import { describe, expect, test, vi } from 'vitest'
|
|
|
|
import { iapl } from '../src/plugin.js'
|
|
import { adminSite, SIBLING } from './adminSameOriginSuite.js'
|
|
|
|
vi.mock('server-only', () => ({}))
|
|
vi.mock('next/headers.js', async () => (await import('./http/server.js')).nextHeadersMock)
|
|
|
|
const { action } = adminSite(false)
|
|
|
|
describe('adminSameOrigin: false', () => {
|
|
test('a request from a sibling subdomain reaches the action, as before 1.18.0', async () => {
|
|
expect((await action('/ipal/cookie-approval', SIBLING, '{"ids":[]}')).status).toBe(200)
|
|
})
|
|
|
|
test('a value nobody understands stops the start', async () => {
|
|
const i18n = { defaultLocale: 'en', locales: [{ code: 'en', label: 'English' }] }
|
|
await expect((async () => iapl({ adminSameOrigin: 0 as never, i18n } as never)({ collections: [], secret: 'x' } as never))()).rejects.toThrow(/adminSameOrigin must be/)
|
|
await expect((async () => iapl({ adminSameOrigin: { origins: 'https://a.example' as never }, i18n } as never)({ collections: [], secret: 'x' } as never))()).rejects.toThrow(/adminSameOrigin\.origins must be a list/)
|
|
})
|
|
})
|