Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app/(payload)/admin/importMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { RowLabel as RowLabel_ec255a65fa6fa8d1faeb09cf35284224 } from '@/Header/
import { RowLabel as RowLabel_1f6ff6ff633e3695d348f4f3c58f1466 } from '@/Footer/RowLabel'
import { default as default_8a7ab0eb7ab5c511aba12e68480bfe5e } from '@/components/BeforeLogin'
import { NewsRadarNavLink as NewsRadarNavLink_8d91a43e5c2a4ab5 } from '@/components/NewsRadarNavLink'
import { SetupRubricsNavControl } from '@/components/SetupRubricsNavControl'
import { VercelBlobClientUploadHandler as VercelBlobClientUploadHandler_16c82c5e25f430251a3e3ba57219ff4e } from '@payloadcms/storage-vercel-blob/client'
import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc'

Expand Down Expand Up @@ -59,6 +60,7 @@ export const importMap = {
"@/Footer/RowLabel#RowLabel": RowLabel_1f6ff6ff633e3695d348f4f3c58f1466,
"@/components/BeforeLogin#default": default_8a7ab0eb7ab5c511aba12e68480bfe5e,
"@/components/NewsRadarNavLink#NewsRadarNavLink": NewsRadarNavLink_8d91a43e5c2a4ab5,
"@/components/SetupRubricsNavControl#SetupRubricsNavControl": SetupRubricsNavControl,
"@payloadcms/storage-vercel-blob/client#VercelBlobClientUploadHandler": VercelBlobClientUploadHandler_16c82c5e25f430251a3e3ba57219ff4e,
"@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1
}
22 changes: 22 additions & 0 deletions tests/unit/payloadNavImportMap.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { readFile } from 'node:fs/promises'
import path from 'node:path'
import { describe, expect, it } from 'vitest'

describe('Payload admin registration', () => {
it('contains an import-map entry for each registered admin navigation control', async () => {
const root = process.cwd()
const [config, map] = await Promise.all([
readFile(path.join(root, 'src/payload.config.ts'), 'utf8'),
readFile(path.join(root, 'src/app/(payload)/admin/importMap.js'), 'utf8'),
])
const match = config.match(/afterNavLinks:\s*\[([^\]]+)\]/)
expect(match, 'Payload admin afterNavLinks should be configured').not.toBeNull()
const components = [...(match?.[1] || '').matchAll(/'([^']+)'/g)].map((m) => m[1])
expect(components).toContain('@/components/SetupRubricsNavControl#SetupRubricsNavControl')
for (const component of components) {
expect(map, `Missing generated import-map entry for ${component}`).toContain(
`"${component}":`,
)
}
})
})
Loading