diff options
| author | Adam Malczewski <[email protected]> | 2026-06-28 22:23:25 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-28 22:23:25 +0900 |
| commit | 81e9e7ee9064b98e06a5f947c67a6ec73b7e578d (patch) | |
| tree | a7bbc8d912ab0746af16e4ccfd1623f0f990c828 /packages/cli/src/message.test.ts | |
| parent | 1ea99dd6e2cdcdd6e4f581f3908719d8fa3fc780 (diff) | |
| parent | 8175a3df065155c5a164e29bd1c47aad392ae555 (diff) | |
| download | dispatch-81e9e7ee9064b98e06a5f947c67a6ec73b7e578d.tar.gz dispatch-81e9e7ee9064b98e06a5f947c67a6ec73b7e578d.zip | |
Merge branch 'feature/summon-title' into predev
Diffstat (limited to 'packages/cli/src/message.test.ts')
| -rw-r--r-- | packages/cli/src/message.test.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/packages/cli/src/message.test.ts b/packages/cli/src/message.test.ts index 536d64f..2deb197 100644 --- a/packages/cli/src/message.test.ts +++ b/packages/cli/src/message.test.ts @@ -111,6 +111,22 @@ describe("buildChatRequest", () => { ); expect(req).not.toHaveProperty("workspaceId"); }); + + it("includes title when provided", () => { + const req = buildChatRequest( + { modelName: "m", text: "x", title: "My Task", showReasoning: false }, + { cwd: "/work", message: "x" }, + ); + expect(req.title).toBe("My Task"); + }); + + it("omits title when not provided", () => { + const req = buildChatRequest( + { modelName: "m", text: "x", showReasoning: false }, + { cwd: "/work", message: "x" }, + ); + expect(req).not.toHaveProperty("title"); + }); }); describe("workspace flag → ChatRequest", () => { @@ -145,3 +161,26 @@ describe("workspace flag → ChatRequest", () => { expect(req.workspaceId).toBe("shorthand"); }); }); + +describe("title flag → ChatRequest", () => { + const defaultServer = "http://localhost:24203"; + + it("--title flag sets title on request", () => { + const parsed = parseArgs(["my-model", "--text", "hi", "--title", "My Task"], { + defaultServer, + }); + expect(parsed.kind).toBe("chat"); + if (parsed.kind !== "chat") return; + const req = buildChatRequest(parsed, { cwd: "/work", message: "hi" }); + expect(req.title).toBe("My Task"); + }); + + it("--title flag omitted sends no title", () => { + const parsed = parseArgs(["my-model", "--text", "hi"], { defaultServer }); + expect(parsed.kind).toBe("chat"); + if (parsed.kind !== "chat") return; + const req = buildChatRequest(parsed, { cwd: "/work", message: "hi" }); + expect(req.title).toBeUndefined(); + expect(req).not.toHaveProperty("title"); + }); +}); |
