import { describe, it, expect } from "vitest";
import { sequentialThinkingHandler } from "./thinking.js";
describe("Thinking Tools", () => {
describe("sequential_thinking", () => {
it("should record a simple thought", () => {
const result = sequentialThinkingHandler({
thought: "This is step 1",
step: 1,
total_steps: 3,
next_action: "CONTINUE",
});
const text = result.content[0].text;
const json = JSON.parse(text);
expect(json.status).toBe("THOUGHT_RECORDED");
expect(json.thought_complexity).toBe("Low");
expect(json.assessment.quality).toBe("Low");
expect(json.assessment.suggestions).toContain("Proceed with next step.");
});
it("should identify high complexity thought", () => {
const longThought = "a".repeat(501);
const result = sequentialThinkingHandler({
thought: longThought,
step: 2,
total_steps: 3,
next_action: "CONTINUE",
});
const json = JSON.parse(result.content[0].text);
expect(json.thought_complexity).toBe("High");
expect(json.assessment.suggestions).toContain(
"This step is complex. Consider breaking it down further or using REVISE to double-check key assumptions.",
);
});
it("should suggest increasing steps if at end", () => {
const result = sequentialThinkingHandler({
thought: "Wait, I need more time",
step: 3,
total_steps: 3,
next_action: "CONTINUE",
});
const json = JSON.parse(result.content[0].text);
expect(json.assessment.warnings).toContain(
"You are at the final step but chose CONTINUE. Did you mean to conclude or do you need more steps?",
);
});
});
});