diff --git a/tests/unit/campaignComponents.unit.spec.ts b/tests/unit/campaignComponents.unit.spec.ts index 850751f0..a6498992 100644 --- a/tests/unit/campaignComponents.unit.spec.ts +++ b/tests/unit/campaignComponents.unit.spec.ts @@ -185,17 +185,21 @@ describe('campaign visual foundation', () => { }) it.each([ - ['engajado', 'Engajado'], - ['a_abordar', 'A abordar'], - ['em_disputa', 'Em disputa'], - ['lembranca', 'Lembrança'], - ['negativo', 'Negativo'], - ] as const)('renders the %s support status with text and semantic state', (status, label) => { - const html = renderToStaticMarkup(createElement(SupportStatusBadge, { status })) + ['engajado', 'Engajado', 'support-engaged'], + ['a_abordar', 'A abordar', 'support-to-approach'], + ['em_disputa', 'Em disputa', 'support-disputed'], + ['lembranca', 'Lembrança', 'support-remembered'], + ['negativo', 'Negativo', 'support-negative'], + ] as const)( + 'renders the %s support status with text, semantic state and variant', + (status, label, variant) => { + const html = renderToStaticMarkup(createElement(SupportStatusBadge, { status })) - expect(html).toContain(label) - expect(html).toContain(`data-support-status="${status}"`) - }) + expect(html).toContain(label) + expect(html).toContain(`data-support-status="${status}"`) + expect(html).toContain(`data-variant="${variant}"`) + }, + ) it('qualifies TSE zones instead of showing an ambiguous number', () => { const html = renderToStaticMarkup(createElement(TseZoneBadge, { zoneNumber: 12 })) diff --git a/tests/unit/peopleListUrl.unit.spec.ts b/tests/unit/peopleListUrl.unit.spec.ts index 3a3ae00d..2478c595 100644 --- a/tests/unit/peopleListUrl.unit.spec.ts +++ b/tests/unit/peopleListUrl.unit.spec.ts @@ -50,6 +50,14 @@ describe('people list URL contract', () => { ).toEqual({ page: 1, municipalities: [12, 3], statuses: ['engajado', 'em_disputa'] }) }) + it('canonicalizes selecting every status member to the absent filter (C119)', () => { + expect( + parsePeopleListParams({ + status: ['engajado', 'a_abordar', 'em_disputa', 'lembranca', 'negativo'], + }), + ).toEqual({ page: 1 }) + }) + it('serializes canonical params in stable order and omits defaults', () => { const params = serializeCanonicalPeopleListSearchParams({ page: 1, diff --git a/tests/unit/peopleMerge.unit.spec.ts b/tests/unit/peopleMerge.unit.spec.ts index 9dfc4383..15a3e0d7 100644 --- a/tests/unit/peopleMerge.unit.spec.ts +++ b/tests/unit/peopleMerge.unit.spec.ts @@ -221,4 +221,26 @@ describe('peopleFilterFacetsFromRows', () => { expect(facets.municipalityIDs).toEqual([1, 3, 4, 5, 6, 99]) expect(facets.statuses).toEqual(['engajado']) }) + + it('keeps every leadership status present in the rows, in canonical selector order (C119)', () => { + const withAllStatuses: PeopleMergeSources = { + ...source, + leaderships: (['engajado', 'a_abordar', 'em_disputa', 'lembranca', 'negativo'] as const).map( + (supportStatus, index) => ({ + ...source.leaderships[0]!, + id: 10 + index, + contactID: 100 + index, + supportStatus, + }), + ), + } + const facets = peopleFilterFacetsFromRows(mergePeopleSources(withAllStatuses), { page: 1 }) + expect(facets.statuses).toEqual([ + 'engajado', + 'a_abordar', + 'em_disputa', + 'lembranca', + 'negativo', + ]) + }) })