Skip to content

Commit d4fee72

Browse files
wesmclaude
andcommitted
test: assert exact Copilot resume command with prefix stripping
Use a realistic prefixed session ID (copilot:abc123) and assert the exact command string to verify the agent-prefix stripping logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 00fde4a commit d4fee72

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

internal/server/resume_handler_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ func TestResumeSession(t *testing.T) {
5454

5555
t.Run("copilot command only", func(t *testing.T) {
5656
projectDir := t.TempDir()
57-
te.seedSession(t, "copilot-1", projectDir, 3, func(s *db.Session) {
57+
// Use a prefixed ID to exercise the agent-prefix stripping
58+
// logic (e.g. "copilot:abc123" → raw ID "abc123").
59+
te.seedSession(t, "copilot:abc123", projectDir, 3, func(s *db.Session) {
5860
s.Agent = "copilot"
5961
})
6062
w := te.post(t,
61-
"/api/v1/sessions/copilot-1/resume",
63+
"/api/v1/sessions/copilot:abc123/resume",
6264
`{"command_only":true}`,
6365
)
6466
assertStatus(t, w, http.StatusOK)
@@ -72,8 +74,9 @@ func TestResumeSession(t *testing.T) {
7274
if resp.Launched {
7375
t.Error("expected launched=false for command_only")
7476
}
75-
if resp.Command == "" {
76-
t.Error("expected non-empty command")
77+
wantCmd := "copilot --resume=abc123"
78+
if resp.Command != wantCmd {
79+
t.Errorf("command = %q, want %q", resp.Command, wantCmd)
7780
}
7881
})
7982

0 commit comments

Comments
 (0)