1import { assertEquals } from "@std/assert";23import {4 dateToSlug,5 isPastDate,6 rolloverExpiredProgress,7} from "@/lib/date/daily.ts";8import type { PuzzleProgress } from "@/lib/shikaku/types.ts";910Deno.test("dateToSlug formats local dates as YYYY-MM-DD", () => {11 const slug = dateToSlug(new Date(2026, 3, 16, 12, 30, 45));1213 assertEquals(slug, "2026-04-16");14});1516Deno.test("isPastDate compares date slugs correctly", () => {17 assertEquals(isPastDate("2026-04-15", "2026-04-16"), true);18 assertEquals(isPastDate("2026-04-16", "2026-04-16"), false);19 assertEquals(isPastDate("2026-04-17", "2026-04-16"), false);20});2122Deno.test("rolloverExpiredProgress archives unfinished progress from prior days", () => {23 const progress: PuzzleProgress = {24 date: "2026-04-15",25 puzzleId: "daily-2026-04-15",26 startedAt: "2026-04-15T08:00:00.000Z",27 updatedAt: "2026-04-15T08:10:00.000Z",28 status: "in_progress",29 elapsedMs: 600000,30 mistakes: 2,31 selections: [],32 notes: {},33 lastViewedAt: "2026-04-15T08:10:00.000Z",34 clientVersion: 1,35 };3637 assertEquals(rolloverExpiredProgress(progress, "2026-04-16"), {38 date: "2026-04-15",39 puzzleId: "daily-2026-04-15",40 status: "expired_unsolved",41 mistakes: 2,42 });43});