1import { assertEquals } from "@std/assert";23import { getGridPointFromBoardPosition } from "@/lib/shikaku/interaction.ts";45Deno.test("getGridPointFromBoardPosition maps pointer coordinates into board cells", () => {6 const point = getGridPointFromBoardPosition(7 { left: 100, top: 200, width: 320, height: 320 },8 { clientX: 250, clientY: 360 },9 { rows: 8, cols: 8 },10 );1112 assertEquals(point, { row: 4, col: 3 });13});1415Deno.test("getGridPointFromBoardPosition clamps pointers that drift outside the board", () => {16 const point = getGridPointFromBoardPosition(17 { left: 100, top: 200, width: 320, height: 320 },18 { clientX: 500, clientY: 50 },19 { rows: 8, cols: 8 },20 );2122 assertEquals(point, { row: 0, col: 7 });23});2425Deno.test("getGridPointFromBoardPosition handles compact boards accurately", () => {26 const point = getGridPointFromBoardPosition(27 { left: 0, top: 0, width: 240, height: 160 },28 { clientX: 179, clientY: 119 },29 { rows: 4, cols: 6 },30 );3132 assertEquals(point, { row: 2, col: 4 });33});