import { describe, it, expect } from "vitest"; import { EFFORT_OPTIONS, VALID_EFFORTS, normalizeEffort, } from "./reasoning-effort"; describe("normalizeEffort", () => { it("treats empty/unset as the Hermes default (medium)", () => { expect(normalizeEffort("")).toBe("medium"); expect(normalizeEffort(null)).toBe("medium"); expect(normalizeEffort(undefined)).toBe("medium"); expect(normalizeEffort(" ")).toBe("medium"); }); it("passes through every valid effort level", () => { for (const level of ["none", "minimal", "low", "medium", "high", "xhigh"]) { expect(normalizeEffort(level)).toBe(level); } }); it("is case- and whitespace-insensitive", () => { expect(normalizeEffort("HIGH")).toBe("high"); expect(normalizeEffort(" XHigh ")).toBe("xhigh"); }); it("falls back to medium for unknown values", () => { expect(normalizeEffort("turbo")).toBe("medium"); expect(normalizeEffort("max")).toBe("medium"); // 'max' is a label, not a value expect(normalizeEffort(42)).toBe("medium"); }); }); describe("EFFORT_OPTIONS", () => { it("every option value is in VALID_EFFORTS (no orphan labels)", () => { for (const opt of EFFORT_OPTIONS) { expect(VALID_EFFORTS.has(opt.value)).toBe(true); } }); it("covers the real reasoning levels plus thinking-off", () => { // Invariant against hermes_constants.VALID_REASONING_EFFORTS + 'none'. const values = new Set(EFFORT_OPTIONS.map((o) => o.value)); for (const level of ["none", "minimal", "low", "medium", "high", "xhigh"]) { expect(values.has(level)).toBe(true); } }); });