mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-27 06:13:06 +00:00
Drop the dual-path list flag so the eight staff list routes share one shell wiring path, matching the OH14 always-on hybrid cleanup.
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { existsSync, readFileSync } from 'node:fs'
|
|
import { join } from 'node:path'
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import { opsListDomains, opsListRegistry } from '@/lib/opsListRegistry/opsListRegistry'
|
|
|
|
const routePagePath = (routePath: string): string => {
|
|
const segment = routePath.replace(/^\/campanha\//, '')
|
|
return join(process.cwd(), 'src/app/(campaign)/campanha/(app)', segment, 'page.tsx')
|
|
}
|
|
|
|
const expectOpsListFactoryWiring = (source: string) => {
|
|
expect(source).toContain('OpsListPage')
|
|
expect(source).toContain("from '@/components/campaign/shared/OpsListPage'")
|
|
expect(source).not.toContain('resolveListUnifiedEnabled')
|
|
expect(source).not.toContain('opsListFlag')
|
|
}
|
|
|
|
describe('opsListRegistry v1 routes (CL8)', () => {
|
|
it.each(opsListDomains)('%s has a route page that delegates to the list factory', (slug) => {
|
|
const { routePath } = opsListRegistry[slug]
|
|
const pagePath = routePagePath(routePath)
|
|
|
|
expect(existsSync(pagePath), `missing route file for ${slug}: ${pagePath}`).toBe(true)
|
|
expectOpsListFactoryWiring(readFileSync(pagePath, 'utf8'))
|
|
})
|
|
|
|
it('maps every registry routePath under /campanha/', () => {
|
|
for (const slug of opsListDomains) {
|
|
expect(opsListRegistry[slug].routePath).toMatch(/^\/campanha\/[a-z]+$/)
|
|
expect(routePagePath(opsListRegistry[slug].routePath)).toContain(
|
|
`/campanha/(app)/${slug}/page.tsx`,
|
|
)
|
|
}
|
|
})
|
|
})
|