mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-27 06:13:06 +00:00
- Pin slug↔rota: tests/unit/opsListRegistryRoutes.unit.spec.ts (8 slugs v1) - resolveDemandListUrl + resolveOrganizationListUrl; pages redirect; registry canonicalRedirect: true para demandas/organizacoes - E2E tracer saved filters com LIST_UNIFIED=1; flag em next/playwright env - Docs: CHANGELOG, lista-unificada spec, plano CL8 entregue Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
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('resolveListUnifiedEnabled')
|
|
expect(source).toContain('OpsListPage')
|
|
expect(source).toContain("from '@/components/campaign/shared/OpsListPage'")
|
|
expect(source).toContain("from '@/lib/opsListRegistry/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`,
|
|
)
|
|
}
|
|
})
|
|
})
|