web: move to vitest
This commit is contained in:
@@ -1,24 +1,23 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import { secondsUntilOsloMidnight } from "./revalidation.ts";
|
||||
|
||||
test("normal day: 12:00 CEST is 12h from midnight", () => {
|
||||
const now = new Date("2026-07-07T10:00:00Z");
|
||||
assert.equal(secondsUntilOsloMidnight(now), 12 * 3600);
|
||||
expect(secondsUntilOsloMidnight(now)).toBe(12 * 3600);
|
||||
});
|
||||
|
||||
test("clamps to 60s just before midnight", () => {
|
||||
const now = new Date("2026-07-07T21:59:30Z");
|
||||
assert.equal(secondsUntilOsloMidnight(now), 60);
|
||||
expect(secondsUntilOsloMidnight(now)).toBe(60);
|
||||
});
|
||||
|
||||
test("DST fall-back day is 25h (2026-10-25)", () => {
|
||||
const now = new Date("2026-10-24T22:00:00Z");
|
||||
assert.equal(secondsUntilOsloMidnight(now), 25 * 3600);
|
||||
expect(secondsUntilOsloMidnight(now)).toBe(25 * 3600);
|
||||
});
|
||||
|
||||
test("DST spring-forward day is 23h (2026-03-29)", () => {
|
||||
const now = new Date("2026-03-28T23:00:00Z");
|
||||
assert.equal(secondsUntilOsloMidnight(now), 23 * 3600);
|
||||
expect(secondsUntilOsloMidnight(now)).toBe(23 * 3600);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user