import test from "node:test"; import assert from "node:assert/strict"; import { effectiveThreshold } from "../src/token-accounting.ts"; test("absolute token threshold wins on large windows", () => { assert.equal(effectiveThreshold(200_000, 0.6, 1_000_000), 200_000); }); test("window ratio caps the threshold on small windows", () => { assert.equal(effectiveThreshold(200_000, 0.6, 272_000), 163_200); assert.equal(effectiveThreshold(100_000, 0.35, 272_000), 95_200); }); test("a missing context window falls back to the absolute threshold", () => { assert.equal(effectiveThreshold(200_000, 0.6, 0), 200_000); assert.equal(effectiveThreshold(200_000, 0.6, -1), 200_000); });