web: move to vitest

This commit is contained in:
2026-08-04 03:02:09 +02:00
parent eabcd47bfd
commit 6370373f0d
6 changed files with 1228 additions and 17 deletions
+1194 -9
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -7,7 +7,8 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "node --test src/lib/*.test.ts",
"test": "vitest run",
"test:watch": "vitest",
"codegen": "graphql-codegen",
"perf:build": "next build",
"perf:serve": "next start -p 3100",
@@ -45,6 +46,7 @@
"eslint-config-next": "16.2.10",
"lighthouse": "^13.4.0",
"typescript": "^6",
"vitest": "^4.1.10",
"wait-on": "^9.0.10"
},
"overrides": {
+5 -6
View File
@@ -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);
});
+13
View File
@@ -0,0 +1,13 @@
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/**/*.test.{ts,tsx}"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
});