Files
oh-my-pi/packages/coding-agent/test/cli-hide-thinking-flag.test.ts
T
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00

46 lines
1.6 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { Effort } from "@oh-my-pi/pi-ai";
import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args";
describe("parseArgs — --hide-thinking flag", () => {
it("parses --hide-thinking as a boolean flag", () => {
const result = parseArgs(["--hide-thinking"]);
expect(result.hideThinking).toBe(true);
});
it("defaults hideThinking to undefined when flag is not provided", () => {
const result = parseArgs([]);
expect(result.hideThinking).toBeUndefined();
});
it("parses --hide-thinking with other flags", () => {
const result = parseArgs(["--hide-thinking", "--model", "opus", "hello"]);
expect(result.hideThinking).toBe(true);
expect(result.model).toBe("opus");
expect(result.messages).toContain("hello");
});
it("parses --hide-thinking with --thinking flag (both can coexist)", () => {
const result = parseArgs(["--hide-thinking", "--thinking", "xhigh"]);
expect(result.hideThinking).toBe(true);
expect(result.thinking).toBe(Effort.XHigh);
});
it("parses --hide-thinking in any position", () => {
const result1 = parseArgs(["--hide-thinking", "prompt"]);
const result2 = parseArgs(["prompt", "--hide-thinking"]);
const result3 = parseArgs(["--model", "opus", "--hide-thinking", "prompt"]);
expect(result1.hideThinking).toBe(true);
expect(result2.hideThinking).toBe(true);
expect(result3.hideThinking).toBe(true);
});
it("does not consume a value after --hide-thinking", () => {
const result = parseArgs(["--hide-thinking", "--model", "opus"]);
expect(result.hideThinking).toBe(true);
expect(result.model).toBe("opus");
expect(result.messages).toEqual([]);
});
});