teqo-backup/tests/unit/leadershipNameTruncate.unit.spec.ts
Francisco Ignácio Fontoura Solla dbd9d0fa3e feat(campanha): ship B70 leadership update wizard (grid + short form).
Replaces the post-municipality stub with a full wizard: tile grid, contact+leadership writes, entryAction skip, and Continuar after save.
2026-07-30 03:51:25 -03:00

17 lines
638 B
TypeScript

import { describe, expect, it } from 'vitest'
import { truncateNameAtWordBoundary } from '@/lib/leadershipNameTruncate'
describe('truncateNameAtWordBoundary', () => {
it('returns the full name when it fits', () => {
expect(truncateNameAtWordBoundary('Maria Silva', 20)).toBe('Maria Silva')
})
it('truncates at the last whole word that fits', () => {
expect(truncateNameAtWordBoundary('Fernando da Costa Lima', 12)).toBe('Fernando da…')
})
it('falls back to character slice when the first word exceeds the limit', () => {
expect(truncateNameAtWordBoundary('Supercalifragilistic', 8)).toBe('Superca…')
})
})