teqo/tests/unit/formatRelativeAge.unit.spec.ts
Francisco Ignácio Fontoura Solla e80f4030cb Polish /campanha Field Desk UX and register FD+/FD2 follow-ups.
Align the campaign desk with quieter KPI strips, queues-first dashboard, shared shells, and advanced filters; capture Impeccable design context and the remaining simplify/critique debts on the roadmap.
2026-07-19 08:17:12 -03:00

18 lines
637 B
TypeScript

import { describe, expect, it } from 'vitest'
import { formatRelativeAge } from '@/utilities/formatRelativeAge'
const now = Date.parse('2026-07-19T12:00:00.000Z')
describe('formatRelativeAge', () => {
it('formats minutes and hours with numeric cues', () => {
expect(formatRelativeAge(now - 5 * 60_000, now)).toContain('5')
expect(formatRelativeAge(now - 3 * 60 * 60_000, now)).toContain('3')
})
it('formats multi-day spans via Intl auto rules', () => {
expect(formatRelativeAge(now - 2 * 24 * 60 * 60_000, now)).toBe(
new Intl.RelativeTimeFormat('pt-BR', { numeric: 'auto' }).format(-2, 'day'),
)
})
})