import assert from 'node:assert/strict'; import test from 'node:test'; import { formatMileageSnapshotDateTime, formatMileageSnapshotTime } from './data-freshness.js'; test('formats snapshot instants in Asia/Shanghai', () => { assert.equal(formatMileageSnapshotTime('2026-08-07T07:45:06.000Z'), '15:45:06'); }); test('keeps historical date snapshots explicit', () => { assert.equal(formatMileageSnapshotTime('2026-08-06'), '2026-08-06'); assert.equal(formatMileageSnapshotTime(null), '--:--:--'); }); test('formats assessment snapshot instants with the business date and minute', () => { assert.equal(formatMileageSnapshotDateTime('2026-08-07T09:45:01.000Z'), '2026.8.7 17:45'); assert.equal(formatMileageSnapshotDateTime(null), '--'); assert.equal(formatMileageSnapshotDateTime('not-a-date'), 'not-a-date'); });