-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathtaskInput.test.ts
More file actions
50 lines (46 loc) · 1.76 KB
/
Copy pathtaskInput.test.ts
File metadata and controls
50 lines (46 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { describe, expect, it } from "vitest";
import { buildWorktreeAdoptionInput, prepareTaskInput } from "./taskInput";
describe("prepareTaskInput", () => {
// The isCloud guard on customInstructions is the only thing preventing
// double-injection: local tasks already receive personalization via the
// workspace-server system prompt, so the field must be dropped for them and
// only passed through for cloud.
it.each([
{ workspaceMode: "cloud" as const, expected: "Always use tabs." },
{ workspaceMode: "local" as const, expected: undefined },
{ workspaceMode: "worktree" as const, expected: undefined },
])(
"passes customInstructions through only for cloud (%s)",
({ workspaceMode, expected }) => {
const input = prepareTaskInput("do the thing", [], {
workspaceMode,
customInstructions: "Always use tabs.",
});
expect(input.customInstructions).toBe(expected);
},
);
it("drops customInstructions for cloud when none is set", () => {
const input = prepareTaskInput("do the thing", [], {
workspaceMode: "cloud",
});
expect(input.customInstructions).toBeUndefined();
});
});
describe("buildWorktreeAdoptionInput", () => {
it("builds a promptless worktree input that adopts the branch's worktree", () => {
const input = buildWorktreeAdoptionInput({
repoPath: "/repo",
branch: "feature/orphan",
});
expect(input).toEqual({
taskDescription: "feature/orphan",
repoPath: "/repo",
workspaceMode: "worktree",
branch: "feature/orphan",
reuseExistingWorktree: true,
});
// No content: the saga must not build an initial prompt, so the agent
// session starts idle in the adopted worktree.
expect(input.content).toBeUndefined();
});
});