Skip to content

Commit 2ac2b3b

Browse files
centdixclaude
andcommitted
test: cover agent selection edge cases
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b86d9f8 commit 2ac2b3b

3 files changed

Lines changed: 35 additions & 14 deletions

File tree

bin/src/worktree-commands.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ describe("parseAddCommandArgs", () => {
144144
});
145145
});
146146

147+
it("rejects empty agent ids", () => {
148+
expect(() => parseAddCommandArgs(["feature/search", "--agent", " "])).toThrow("Agent id cannot be empty");
149+
});
150+
147151
it("returns null for help", () => {
148152
expect(parseAddCommandArgs(["--help"])).toBeNull();
149153
});

frontend/src/App.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,23 @@ describe("App create selection", () => {
587587
});
588588
});
589589

590+
it("shows prefixed branch previews when multiple agents are selected", async () => {
591+
vi.mocked(fetchWorktrees).mockResolvedValue([]);
592+
593+
render(App);
594+
595+
await fireEvent.click(screen.getByTitle("New Worktree (Cmd+K)"));
596+
await screen.findByText("New Worktree");
597+
598+
await fireEvent.click(screen.getByRole("checkbox", { name: /Codex builtin chat resume/i }));
599+
await fireEvent.input(screen.getByLabelText(/Branch name/i), {
600+
target: { value: "feature/new" },
601+
});
602+
603+
expect(screen.getByText("claude-feature/new")).toBeInTheDocument();
604+
expect(screen.getByText("codex-feature/new")).toBeInTheDocument();
605+
});
606+
590607
it("submits multi-agent worktree creation when multiple agents are selected", async () => {
591608
vi.mocked(fetchWorktrees).mockResolvedValue([]);
592609
vi.mocked(api.createWorktree).mockResolvedValue({

to-do.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,24 @@
8585
- [x] Update help text and tests accordingly.
8686

8787
## 13. Add backend tests
88-
- Registry tests
89-
- Config read/write tests for custom agents
90-
- Multi-agent target expansion tests
91-
- Launch command generation tests for custom agents
92-
- Validation tests for unknown/duplicate/invalid agents
93-
- Conversation capability tests for unsupported agents
88+
- [x] Registry tests
89+
- [x] Config read/write tests for custom agents
90+
- [x] Multi-agent target expansion tests
91+
- [x] Launch command generation tests for custom agents
92+
- [x] Validation tests for unknown/duplicate/invalid agents
93+
- [x] Conversation capability tests for unsupported agents
9494

9595
## 14. Add frontend tests
96-
- Settings agent-management flows
97-
- Create-worktree multi-select behavior
98-
- Branch preview behavior
99-
- Capability-driven chat visibility
100-
- API integration typing and state transitions
96+
- [x] Settings agent-management flows
97+
- [x] Create-worktree multi-select behavior
98+
- [x] Branch preview behavior
99+
- [ ] Capability-driven chat visibility
100+
- [x] API integration typing and state transitions
101101

102102
## 15. Add CLI tests
103-
- Parsing repeated or multiple agent selections
104-
- Validation behavior for invalid agent ids
105-
- Successful multi-agent worktree creation inputs
103+
- [x] Parsing repeated or multiple agent selections
104+
- [x] Validation behavior for invalid agent ids
105+
- [x] Successful multi-agent worktree creation inputs
106106

107107
## 16. Roll out incrementally
108108
- First land types and contracts.

0 commit comments

Comments
 (0)