feat: launch local-first Sudoku workbench

This commit is contained in:
2026-08-30 14:14:11 +02:00
commit 659640b231
97 changed files with 19111 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import { describe, expect, it } from "vitest";
import {
createSession,
enterSelection,
eraseSelection,
maskValues,
valueForKey,
} from "../../src/state/session";
describe("play session", () => {
it("protects givens and toggles values and notes", () => {
const givens = [5, 0, 0, 0];
let state = createSession(givens);
state = enterSelection(state, new Set([0, 1]), "value", 3, givens);
expect(state.values).toEqual([5, 3, 0, 0]);
state = enterSelection(state, new Set([2]), "center", 2, givens);
state = enterSelection(state, new Set([2]), "center", 4, givens);
expect(maskValues(state.centerMarks[2]!, 4)).toEqual([2, 4]);
state = eraseSelection(state, new Set([0, 1]), "value", givens);
expect(state.values).toEqual([5, 0, 0, 0]);
});
it("maps keyboard symbols through hexadecimal-sized grids", () => {
expect(valueForKey("9", 9)).toBe(9);
expect(valueForKey("A", 16)).toBe(10);
expect(valueForKey("G", 16)).toBe(16);
expect(valueForKey("H", 16)).toBeNull();
});
});