mirror of
https://github.com/fsolla/teqo.git
synced 2026-12-03 05:43:04 +00:00
test(C119): pina facet de status na lista de pessoas, parse exaustivo da URL de pessoas e variant do badge
This commit is contained in:
parent
3a4e44f422
commit
c91b6a508d
3 changed files with 44 additions and 10 deletions
|
|
@ -185,17 +185,21 @@ describe('campaign visual foundation', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['engajado', 'Engajado'],
|
['engajado', 'Engajado', 'support-engaged'],
|
||||||
['a_abordar', 'A abordar'],
|
['a_abordar', 'A abordar', 'support-to-approach'],
|
||||||
['em_disputa', 'Em disputa'],
|
['em_disputa', 'Em disputa', 'support-disputed'],
|
||||||
['lembranca', 'Lembrança'],
|
['lembranca', 'Lembrança', 'support-remembered'],
|
||||||
['negativo', 'Negativo'],
|
['negativo', 'Negativo', 'support-negative'],
|
||||||
] as const)('renders the %s support status with text and semantic state', (status, label) => {
|
] as const)(
|
||||||
const html = renderToStaticMarkup(createElement(SupportStatusBadge, { status }))
|
'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(label)
|
||||||
expect(html).toContain(`data-support-status="${status}"`)
|
expect(html).toContain(`data-support-status="${status}"`)
|
||||||
})
|
expect(html).toContain(`data-variant="${variant}"`)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
it('qualifies TSE zones instead of showing an ambiguous number', () => {
|
it('qualifies TSE zones instead of showing an ambiguous number', () => {
|
||||||
const html = renderToStaticMarkup(createElement(TseZoneBadge, { zoneNumber: 12 }))
|
const html = renderToStaticMarkup(createElement(TseZoneBadge, { zoneNumber: 12 }))
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,14 @@ describe('people list URL contract', () => {
|
||||||
).toEqual({ page: 1, municipalities: [12, 3], statuses: ['engajado', 'em_disputa'] })
|
).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', () => {
|
it('serializes canonical params in stable order and omits defaults', () => {
|
||||||
const params = serializeCanonicalPeopleListSearchParams({
|
const params = serializeCanonicalPeopleListSearchParams({
|
||||||
page: 1,
|
page: 1,
|
||||||
|
|
|
||||||
|
|
@ -221,4 +221,26 @@ describe('peopleFilterFacetsFromRows', () => {
|
||||||
expect(facets.municipalityIDs).toEqual([1, 3, 4, 5, 6, 99])
|
expect(facets.municipalityIDs).toEqual([1, 3, 4, 5, 6, 99])
|
||||||
expect(facets.statuses).toEqual(['engajado'])
|
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',
|
||||||
|
])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue