2026-02-26 16:33:10 -06:00
|
|
|
import { describe, expect, it } from "vitest";
|
2026-03-03 08:45:26 -06:00
|
|
|
import { isClaudeMaxTurnsResult } from "@paperclipai/adapter-claude-local/server";
|
2026-02-26 16:33:10 -06:00
|
|
|
|
|
|
|
|
describe("claude_local max-turn detection", () => {
|
|
|
|
|
it("detects max-turn exhaustion by subtype", () => {
|
|
|
|
|
expect(
|
|
|
|
|
isClaudeMaxTurnsResult({
|
|
|
|
|
subtype: "error_max_turns",
|
|
|
|
|
result: "Reached max turns",
|
|
|
|
|
}),
|
|
|
|
|
).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("detects max-turn exhaustion by stop_reason", () => {
|
|
|
|
|
expect(
|
|
|
|
|
isClaudeMaxTurnsResult({
|
|
|
|
|
stop_reason: "max_turns",
|
|
|
|
|
}),
|
|
|
|
|
).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("returns false for non-max-turn results", () => {
|
|
|
|
|
expect(
|
|
|
|
|
isClaudeMaxTurnsResult({
|
|
|
|
|
subtype: "success",
|
|
|
|
|
stop_reason: "end_turn",
|
|
|
|
|
}),
|
|
|
|
|
).toBe(false);
|
|
|
|
|
});
|
|
|
|
|
});
|