summaryrefslogtreecommitdiff
path: root/internal/executor/agentmcp_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/executor/agentmcp_test.go')
-rw-r--r--internal/executor/agentmcp_test.go41
1 files changed, 36 insertions, 5 deletions
diff --git a/internal/executor/agentmcp_test.go b/internal/executor/agentmcp_test.go
index 4aeb7cb..c73d6db 100644
--- a/internal/executor/agentmcp_test.go
+++ b/internal/executor/agentmcp_test.go
@@ -12,11 +12,13 @@ import (
// recordingChannel is a fake AgentChannel that records tool invocations.
type recordingChannel struct {
- asked string
- summary string
- spawned []SubtaskSpec
- progress []string
- spawnID string
+ asked string
+ summary string
+ spawned []SubtaskSpec
+ progress []string
+ spawnID string
+ proposedEpics []EpicProposal
+ epicID string
}
func (c *recordingChannel) AskUser(_ context.Context, q string) (string, error) {
@@ -35,6 +37,10 @@ func (c *recordingChannel) RecordProgress(_ context.Context, m string) error {
c.progress = append(c.progress, m)
return nil
}
+func (c *recordingChannel) ProposeEpic(_ context.Context, spec EpicProposal) (string, error) {
+ c.proposedEpics = append(c.proposedEpics, spec)
+ return c.epicID, nil
+}
func resultText(t *testing.T, res *mcp.CallToolResult) string {
t.Helper()
@@ -178,6 +184,31 @@ func TestAgentServer_RecordProgress(t *testing.T) {
}
}
+func TestAgentServer_ProposeEpic(t *testing.T) {
+ ch := &recordingChannel{epicID: "epic-1"}
+ cs := connectInMemory(t, newAgentServer(ch))
+ res, err := cs.CallTool(context.Background(), &mcp.CallToolParams{
+ Name: "propose_epic",
+ Arguments: map[string]any{"name": "Checkout revamp", "description": "relaunch", "story_ids": []string{"s1", "s2"}},
+ })
+ if err != nil {
+ t.Fatalf("CallTool: %v", err)
+ }
+ if len(ch.proposedEpics) != 1 {
+ t.Fatalf("expected 1 proposed epic, got %d", len(ch.proposedEpics))
+ }
+ spec := ch.proposedEpics[0]
+ if spec.Name != "Checkout revamp" || spec.Description != "relaunch" {
+ t.Errorf("epic spec not propagated: %+v", spec)
+ }
+ if len(spec.StoryIDs) != 2 || spec.StoryIDs[0] != "s1" || spec.StoryIDs[1] != "s2" {
+ t.Errorf("story_ids not propagated: %+v", spec.StoryIDs)
+ }
+ if txt := resultText(t, res); !strings.Contains(txt, "epic-1") {
+ t.Errorf("expected returned epic ID in result, got %q", txt)
+ }
+}
+
type bearerRT struct {
token string
base http.RoundTripper