Files
fusion/packages/cli/src/__tests__/bin-chat-args.test.ts
gsxdsm e17151cba5 fix(cli-tests): align CLI suite with inbox-mail help, beta versions, and planning-session store
Stale-test drift, no product changes: FN-8424 inbox reply help text and
fn message inbox --user routing, beta-track prerelease suffixes in version
regexes (0.73.0-beta.N), FN-8399 onMigrationProgress in createTaskStoreForBackend,
#2400 workflow-docs heading, and the durable planning-session store mocks for
fn task plan (0412113de/fdd120232).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 22:35:12 -07:00

36 lines
1.5 KiB
TypeScript

import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { describe, expect, it } from "vitest";
import { parseChatCliArgs } from "../commands/chat.js";
describe("fn chat argument parsing", () => {
it("passes --conversation-id through from argv-shaped chat arguments", () => {
expect(parseChatCliArgs(["agent-001", "hello", "--conversation-id", "custom-thread"])).toMatchObject({
agentId: "agent-001",
contentArg: "hello",
once: true,
nonInteractive: true,
conversationId: "custom-thread",
});
});
it("rejects a missing --conversation-id value instead of treating it as message content", () => {
expect(parseChatCliArgs(["agent-001", "--conversation-id"])).toMatchObject({
error: expect.stringContaining("Usage: fn chat"),
});
expect(parseChatCliArgs(["agent-001", "--conversation-id", "--once"])).toMatchObject({
error: expect.stringContaining("Usage: fn chat"),
});
expect(parseChatCliArgs(["agent-001", "--conversation-id", "good", "--conversation-id"])).toMatchObject({
error: expect.stringContaining("Usage: fn chat"),
});
});
it("describes fn chat as agent inbox delivery in top-level help", () => {
const source = readFileSync(resolve(__dirname, "../bin.ts"), "utf8");
// FN-8424: chat replies now route through inbox mail with a reply deadline.
expect(source).toContain("Named mailbox conversation with deadline-bounded inbox replies");
});
});