Files
Netcatty/domain/sync.format.test.ts
T
陈大猫 b1f199c4d7 fix(sync): show sync dates and pending-only green dot (#1765) (#1770)
Add yyyymmdd hhmm timestamps to cloud sync history and only show the green status dot when local changes are still pending upload.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 00:12:03 +08:00

15 lines
549 B
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { formatLastSync, formatSyncDateTime } from './sync';
test('formatSyncDateTime renders yyyymmdd hhmm', () => {
const timestamp = new Date(2025, 5, 28, 14, 30, 0).getTime();
assert.equal(formatSyncDateTime(timestamp), '20250628 1430');
});
test('formatLastSync uses compact datetime for older timestamps', () => {
const twoHoursAgo = Date.now() - 2 * 60 * 60 * 1000;
const formatted = formatLastSync(twoHoursAgo);
assert.match(formatted, /^\d{8} \d{4}$/);
});