import test from 'node:test'; import assert from 'node:assert/strict'; import { formatDisplayTime, DISPLAY_TIMEZONE } from '../utils/time.js'; test('DISPLAY_TIMEZONE defaults to America/New_York', () => { // If DISPLAY_TIMEZONE env is unset in test runner, we expect the default. const expected = process.env.DISPLAY_TIMEZONE || 'America/New_York'; assert.equal(DISPLAY_TIMEZONE, expected); }); test('formatDisplayTime: converts UTC instant to Eastern wall clock', () => { // 2026-07-21 18:13:45 UTC → 2:13:45 PM EDT (DST) const d = new Date('2026-07-21T18:13:45.000Z'); const formatted = formatDisplayTime(d); assert.match(formatted, /2:13:45 PM/); assert.match(formatted, /EDT/); }); test('formatDisplayTime: winter offset uses EST', () => { // 2026-01-15 18:00:00 UTC → 1:00:00 PM EST const d = new Date('2026-01-15T18:00:00.000Z'); const formatted = formatDisplayTime(d); assert.match(formatted, /1:00:00 PM/); assert.match(formatted, /EST/); });