(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func TestProposePlan(t *testing.T) { |
| 33 | t.Parallel() |
| 34 | |
| 35 | t.Run("EmptyPathReturnsError", func(t *testing.T) { |
| 36 | t.Parallel() |
| 37 | ctrl := gomock.NewController(t) |
| 38 | mockConn := agentconnmock.NewMockAgentConn(ctrl) |
| 39 | |
| 40 | storeFile, _ := fakeStoreFile(t) |
| 41 | tool := newProposePlanTool(t, mockConn, storeFile) |
| 42 | resp, err := tool.Run(context.Background(), fantasy.ToolCall{ |
| 43 | ID: "call-1", |
| 44 | Name: "propose_plan", |
| 45 | Input: `{"path":""}`, |
| 46 | }) |
| 47 | require.NoError(t, err) |
| 48 | assert.True(t, resp.IsError) |
| 49 | assert.Equal(t, "path is required (use the chat-specific absolute plan path)", resp.Content) |
| 50 | }) |
| 51 | |
| 52 | t.Run("WhitespaceOnlyPathReturnsError", func(t *testing.T) { |
| 53 | t.Parallel() |
| 54 | ctrl := gomock.NewController(t) |
| 55 | mockConn := agentconnmock.NewMockAgentConn(ctrl) |
| 56 | |
| 57 | storeFile, _ := fakeStoreFile(t) |
| 58 | tool := newProposePlanTool(t, mockConn, storeFile) |
| 59 | resp, err := tool.Run(context.Background(), fantasy.ToolCall{ |
| 60 | ID: "call-1", |
| 61 | Name: "propose_plan", |
| 62 | Input: `{"path":" "}`, |
| 63 | }) |
| 64 | require.NoError(t, err) |
| 65 | assert.True(t, resp.IsError) |
| 66 | assert.Equal(t, "path is required (use the chat-specific absolute plan path)", resp.Content) |
| 67 | }) |
| 68 | |
| 69 | t.Run("NonMdPathReturnsError", func(t *testing.T) { |
| 70 | t.Parallel() |
| 71 | ctrl := gomock.NewController(t) |
| 72 | mockConn := agentconnmock.NewMockAgentConn(ctrl) |
| 73 | |
| 74 | storeFile, _ := fakeStoreFile(t) |
| 75 | tool := newProposePlanTool(t, mockConn, storeFile) |
| 76 | resp, err := tool.Run(context.Background(), fantasy.ToolCall{ |
| 77 | ID: "call-1", |
| 78 | Name: "propose_plan", |
| 79 | Input: `{"path":"/home/coder/plan.txt"}`, |
| 80 | }) |
| 81 | require.NoError(t, err) |
| 82 | assert.True(t, resp.IsError) |
| 83 | assert.Equal(t, "path must end with .md", resp.Content) |
| 84 | }) |
| 85 | |
| 86 | t.Run("RelativePlanPathReturnsError", func(t *testing.T) { |
| 87 | t.Parallel() |
| 88 | ctrl := gomock.NewController(t) |
| 89 | mockConn := agentconnmock.NewMockAgentConn(ctrl) |
nothing calls this directly
no test coverage detected