import test from "node:test";
import assert from "node:assert/strict";
import { pickBestCandidate } from "../src/index.js";

test("pickBestCandidate finds nearest in direction", () => {
  const current = { id: "center", x: 100, y: 100, width: 100, height: 100 };
  const candidates = [
    { id: "up", x: 100, y: 0, width: 100, height: 100 },
    { id: "right", x: 220, y: 100, width: 100, height: 100 }
  ];

  const next = pickBestCandidate(current, candidates, "up");
  assert.equal(next?.id, "up");
});
