teqo-backup/tests/unit/campaignEntityListParsers.unit.spec.ts
Cursor Agent 76d6129e1e
CL5: Assessores CampaignTable + URL canónico + OpsListPage
Rewrite AdvisorsTable on CampaignTable with column picker, add
resolveAdvisorListUrl (preserves criar=1), register assessores in
CAMPAIGN_LIST_IDS/opsListRegistry, and wire LIST_UNIFIED factory shell.

Closes #160

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

37 lines
1.4 KiB
TypeScript

/**
* Pins the "simple" entity list parsers ahead of the Pass 2 list-system
* consolidation (W1): organizações and demandas. Assessores moved to
* `advisorListUrl.ts` (CL5); lideranças left earlier in B29.
*/
import { describe, expect, it } from 'vitest'
import { parseDemandListParams } from '@/utilities/campaignDemandData'
import { parseOrganizationListParams } from '@/utilities/organizationData'
describe('parseOrganizationListParams', () => {
it('keeps only known organization kinds', () => {
expect(parseOrganizationListParams({ kind: 'sindicato' }).kind).toBe('sindicato')
expect(parseOrganizationListParams({ kind: 'clube' }).kind).toBeUndefined()
})
it('combines q, kind and page', () => {
expect(parseOrganizationListParams({ q: 'cut', kind: 'sindicato', page: '2' })).toEqual({
page: 2,
q: 'cut',
kind: 'sindicato',
})
})
})
describe('parseDemandListParams', () => {
it('keeps only known statuses and kinds', () => {
expect(parseDemandListParams({ status: 'aberta' }).status).toBe('aberta')
expect(parseDemandListParams({ status: 'fechada' }).status).toBeUndefined()
expect(parseDemandListParams({ kind: 'material' }).kind).toBe('material')
expect(parseDemandListParams({ kind: 'outra-coisa' }).kind).toBeUndefined()
})
it('defaults to page 1 with no filters', () => {
expect(parseDemandListParams({})).toEqual({ page: 1 })
})
})