MCPcopy Create free account
hub / github.com/compozy/agh / TestCommandPathsAndHelpers

Function TestCommandPathsAndHelpers

internal/cli/command_paths_test.go:30–536  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestCommandPathsAndHelpers(t *testing.T) {
31 t.Parallel()
32
33 statusSession := SessionRecord{
34 ID: "sess-1",
35 AgentName: "coder",
36 WorkspaceID: "ws-1",
37 WorkspacePath: "/workspace/project",
38 State: "active",
39 CreatedAt: fixedTestNow,
40 UpdatedAt: fixedTestNow,
41 }
42 statusSessionHealth := SessionHealthRecord{
43 SessionID: "sess-1",
44 AgentName: "coder",
45 WorkspaceID: "ws-1",
46 State: "idle",
47 Health: "healthy",
48 Attachable: true,
49 EligibleForWake: true,
50 UpdatedAt: fixedTestNow,
51 }
52 tempDir := t.TempDir()
53 soulBodyPath := filepath.Join(tempDir, "SOUL.md")
54 if err := os.WriteFile(soulBodyPath, []byte("# Soul\n\nStay precise.\n"), 0o600); err != nil {
55 t.Fatalf("os.WriteFile(SOUL.md) error = %v", err)
56 }
57 heartbeatBodyPath := filepath.Join(tempDir, "HEARTBEAT.md")
58 if err := os.WriteFile(heartbeatBodyPath, []byte("# Heartbeat\n\nCheck in.\n"), 0o600); err != nil {
59 t.Fatalf("os.WriteFile(HEARTBEAT.md) error = %v", err)
60 }
61
62 getCalls := 0
63 networkChannelsCalled := false
64 getAgentSoulCalled := false
65 putAgentSoulCalled := false
66 deleteAgentSoulCalled := false
67 rollbackAgentSoulCalled := false
68 refreshSessionSoulCalled := false
69 getAgentHeartbeatCalled := false
70 putAgentHeartbeatCalled := false
71 deleteAgentHeartbeatCalled := false
72 rollbackAgentHeartbeatCalled := false
73 getAgentHeartbeatStatusCalled := false
74 client := &stubClient{
75 statusFn: func(context.Context) (StatusRecord, error) {
76 return StatusRecord{
77 SchemaVersion: "2026-05-20",
78 GeneratedAt: fixedTestNow,
79 Daemon: DaemonStatus{
80 Status: "running",
81 PID: 10,
82 StartedAt: fixedTestNow.Add(-time.Minute),
83 Socket: "/tmp/agh.sock",
84 HTTPHost: "localhost",
85 HTTPPort: 2123,
86 },
87 Health: contract.ObserveHealthPayload{Status: "ok"},

Callers

nothing calls this directly

Calls 9

SignalFunction · 0.92
AliveFunction · 0.92
newTestDepsFunction · 0.85
executeRootCommandFunction · 0.85
currentWorkingDirectoryFunction · 0.85
mustJSONFunction · 0.70
WriteFileMethod · 0.65
handlerFunction · 0.50
AddMethod · 0.45

Tested by

no test coverage detected