teqo/tests/unit/campaignWizardCopy.unit.spec.ts
Cursor Agent 2fa6e7298a
B104 — Wizard: label genérica "Pular" nas ações encadeadas
Substitui as quatro labels longas de skip (votos, tendência, sinal,
liderança) por uma constante compartilhada WIZARD_CHAIN_SKIP_LABEL.
Resolvers e condições de exibição permanecem intactos (B96/B98).

Closes #131

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

35 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
import {
resolveWizardVotesSkip,
WIZARD_CHAIN_SKIP_LABEL,
WIZARD_DISMISS_ARIA_LABEL,
wizardFlowChromeAriaLabel,
wizardFlowTitleForSlug,
wizardMunicipalityChromeAriaLabel,
} from '@/lib/campaignWizardCopy'
describe('campaignWizardCopy', () => {
it('maps wizard slugs to home action flow titles', () => {
expect(wizardFlowTitleForSlug('atualizar-votos')).toBe('Ajustar votos')
expect(wizardFlowTitleForSlug('registrar-sinal')).toBe('Registrar sinal')
expect(wizardFlowTitleForSlug('inventado')).toBe('Continuar')
})
it('builds wizard chrome aria labels from shared copy', () => {
expect(wizardFlowChromeAriaLabel('Ajustar votos')).toBe('Ação: Ajustar votos')
expect(wizardMunicipalityChromeAriaLabel('Cairu')).toBe('Município em atualização: Cairu')
expect(WIZARD_DISMISS_ARIA_LABEL).toBe('Sair da ação')
})
it('uses the shared chain skip label for embedded vote adjustments', () => {
expect(WIZARD_CHAIN_SKIP_LABEL).toBe('Pular')
expect(resolveWizardVotesSkip(undefined, 'cairu')).toBeUndefined()
expect(resolveWizardVotesSkip('update-votes', 'cairu')).toBeUndefined()
expect(resolveWizardVotesSkip('change-trend', 'cairu')).toEqual({
label: WIZARD_CHAIN_SKIP_LABEL,
href: `${CAMPAIGN_ACTIONS_HOME}/atualizar-lideranca?municipio=cairu&entry=change-trend`,
})
})
})