Make commit history easier to scan and review (#2146)
* feat(app): improve commit history and diff review * fix(app): keep commit timestamps current * fix(app): pause hidden commit clocks * fix(app): reopen commit diff in persistence test
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { formatDuration, formatMessageTimestamp } from "./time";
|
||||
import { formatDuration, formatMessageTimestamp, formatTimeAgo } from "./time";
|
||||
|
||||
describe("formatTimeAgo", () => {
|
||||
const now = new Date("2026-07-16T12:00:00.000Z");
|
||||
|
||||
it.each([
|
||||
["2026-07-16T11:59:55.000Z", "just now"],
|
||||
["2026-07-16T11:59:30.000Z", "30s ago"],
|
||||
["2026-07-16T11:55:00.000Z", "5m ago"],
|
||||
["2026-07-16T10:00:00.000Z", "2h ago"],
|
||||
["2026-07-13T12:00:00.000Z", "3d ago"],
|
||||
["2026-01-15T12:00:00.000Z", "Jan 15"],
|
||||
])("formats %s as %s", (date, expected) => {
|
||||
expect(formatTimeAgo(new Date(date), now)).toBe(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatDuration", () => {
|
||||
it("renders sub-minute durations as whole seconds", () => {
|
||||
|
||||
Reference in New Issue
Block a user