feat(web): log of reads, plays, watches and listens, by month

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas Winther
2026-10-30 22:19:02 +01:00
co-authored by Claude Opus 5.5
parent b38a2674f4
commit ec39491f47
5 changed files with 160 additions and 1 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, test } from "bun:test";
import type { ChangeEvent } from "../src/api.ts";
import { changeValue, describeChange, groupByRun, scheduleLabel, SCHEDULES } from "../src/labels.ts";
import { changeValue, describeChange, groupByRun, logMonth, scheduleLabel, SCHEDULES } from "../src/labels.ts";
const base: ChangeEvent = {
id: "ev1",
@@ -117,3 +117,12 @@ describe("changeValue", () => {
expect(changeValue("review", "x".repeat(300), "5half")).toHaveLength(160);
});
});
describe("logMonth", () => {
test("month headings from partial dates and timestamps", () => {
expect(logMonth("2026-10-01")).toBe("October 2026");
expect(logMonth("2025-03")).toBe("March 2025");
expect(logMonth("2019")).toBe("2019");
expect(logMonth("2026-01-31T23:59:00.000Z")).toBe("January 2026");
});
});