mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 23:53:05 +00:00
- Collection campaignVoteSummarySnapshot (snapshot diário statewide) - Gravação idempotente on-read no loadCampaignHomeSummary + retenção 30d - UI: seta + magnitude ao lado do total B56 (aria-label completo) - Reusa rollup statewide para CG/candidato; assessor vê Δ global (opção A) Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
28 lines
899 B
TypeScript
28 lines
899 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
civilDateDaysBetween,
|
|
civilDateToUtcMidnightIso,
|
|
formatBahiaCivilDate,
|
|
subtractBahiaCivilDays,
|
|
} from '@/lib/campaignTime'
|
|
|
|
describe('Bahia civil date helpers (B57)', () => {
|
|
it('converts civil dates to UTC midnight ISO anchors', () => {
|
|
expect(civilDateToUtcMidnightIso('2026-08-01')).toBe('2026-08-01T00:00:00.000Z')
|
|
})
|
|
|
|
it('subtracts whole civil days', () => {
|
|
expect(subtractBahiaCivilDays('2026-08-08', 7)).toBe('2026-08-01')
|
|
})
|
|
|
|
it('counts calendar days between civil dates', () => {
|
|
expect(civilDateDaysBetween('2026-08-01', '2026-08-08')).toBe(7)
|
|
})
|
|
|
|
it('round-trips formatBahiaCivilDate through subtract', () => {
|
|
const today = formatBahiaCivilDate(new Date('2026-08-08T15:00:00.000Z'))
|
|
expect(today).toBe('2026-08-08')
|
|
expect(subtractBahiaCivilDays(today, 7)).toBe('2026-08-01')
|
|
})
|
|
})
|