teqo/tests/unit/wizardSignalUi.unit.spec.ts
Francisco Ignácio Fontoura Solla 09fa21d4b3 B63: wizard registrar sinal (grid de tipos + passo de texto).
Two-step UX-1 flow on the B59 chassis with URL contract ?signalType= and optional ?entryAction= for embedded skip; reuses createMunicipalityListSignalFormAction.
2026-07-30 04:01:48 -03:00

31 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { municipalitySignalTypeMeta } from '@/lib/municipalitySignalTypeMeta'
import { municipalitySignalTypes } from '@/lib/schemas/municipalityUpdate'
import { shouldShowWizardSignalSkip } from '@/lib/wizardSignalUi'
describe('wizardSignalUi', () => {
it('hides skip for standalone register-signal entry', () => {
expect(shouldShowWizardSignalSkip(undefined)).toBe(false)
expect(shouldShowWizardSignalSkip('register-signal')).toBe(false)
})
it('shows skip when embedded from another wizard action', () => {
expect(shouldShowWizardSignalSkip('update-votes')).toBe(true)
expect(shouldShowWizardSignalSkip('change-trend')).toBe(true)
})
})
describe('municipalitySignalTypeMeta', () => {
it('covers every signal type with icon and info copy', () => {
expect(municipalitySignalTypeMeta).toHaveLength(municipalitySignalTypes.length)
for (const type of municipalitySignalTypes) {
const entry = municipalitySignalTypeMeta.find((item) => item.type === type)
expect(entry?.label.length).toBeGreaterThan(0)
expect(entry?.shortDescription.length).toBeGreaterThan(0)
expect(entry?.infoContent.length).toBeGreaterThan(20)
expect(entry?.icon).toBeTruthy()
}
})
})