teqo-backup/tests/unit/opsListPage.unit.spec.ts
Cursor Agent f49e8e3c55
CL7 — Migrar apoiadores e organizações para OpsListPage
Wire LIST_UNIFIED flag on /campanha/apoiadores and /campanha/organizacoes
behind OpsListPage with full slot parity (KPI overview, filters, table,
footer). Registry entries were already present from CL2; this completes
the route delegation. Pins CL7 routes in opsListPage.unit.spec.ts.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-01 23:22:38 +00:00

57 lines
2.3 KiB
TypeScript

import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
const ROUTE_PAGES = {
municipios: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/municipios/page.tsx'),
liderancas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/liderancas/page.tsx'),
dobradinhas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/dobradinhas/page.tsx'),
demandas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/demandas/page.tsx'),
<<<<<<< HEAD
assessores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/assessores/page.tsx'),
=======
apoiadores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/apoiadores/page.tsx'),
organizacoes: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/organizacoes/page.tsx'),
>>>>>>> dd10d3c (CL7 — Migrar apoiadores e organizações para OpsListPage)
} as const
const expectOpsListPageWiring = (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('OpsListPage municipios tracer (CL3)', () => {
it('wires LIST_UNIFIED behind OpsListPage on the municipios route', () => {
expectOpsListPageWiring(readFileSync(ROUTE_PAGES.municipios, 'utf8'))
})
})
describe('OpsListPage CL4 routes', () => {
it.each(['liderancas', 'dobradinhas', 'demandas'] as const)(
'wires LIST_UNIFIED behind OpsListPage on the %s route',
(route) => {
expectOpsListPageWiring(readFileSync(ROUTE_PAGES[route], 'utf8'))
},
)
})
<<<<<<< HEAD
describe('OpsListPage assessores (CL5)', () => {
it('wires LIST_UNIFIED behind OpsListPage on the assessores route', () => {
const source = readFileSync(ROUTE_PAGES.assessores, 'utf8')
expectOpsListPageWiring(source)
expect(source).toContain('resolveAdvisorListUrl')
})
=======
describe('OpsListPage CL7 routes', () => {
it.each(['apoiadores', 'organizacoes'] as const)(
'wires LIST_UNIFIED behind OpsListPage on the %s route',
(route) => {
expectOpsListPageWiring(readFileSync(ROUTE_PAGES[route], 'utf8'))
},
)
>>>>>>> dd10d3c (CL7 — Migrar apoiadores e organizações para OpsListPage)
})