MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestCodexProvider_LoopCommand

Function TestCodexProvider_LoopCommand

internal/agent/codex_test.go:35–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestCodexProvider_LoopCommand(t *testing.T) {
36 ctx := context.Background()
37 p := NewCodexProvider("/bin/codex")
38 cmd := p.LoopCommand(ctx, "hello world", "/work/dir")
39
40 if cmd.Path != "/bin/codex" {
41 t.Errorf("LoopCommand Path = %q, want /bin/codex", cmd.Path)
42 }
43 wantArgs := []string{"/bin/codex", "exec", "--json", "--yolo", "--skip-git-repo-check", "-C", "/work/dir", "-"}
44 if len(cmd.Args) != len(wantArgs) {
45 t.Fatalf("LoopCommand Args len = %d, want %d: %v", len(cmd.Args), len(wantArgs), cmd.Args)
46 }
47 for i, w := range wantArgs {
48 if cmd.Args[i] != w {
49 t.Errorf("LoopCommand Args[%d] = %q, want %q", i, cmd.Args[i], w)
50 }
51 }
52 if cmd.Dir != "/work/dir" {
53 t.Errorf("LoopCommand Dir = %q, want /work/dir", cmd.Dir)
54 }
55 if cmd.Stdin == nil {
56 t.Error("LoopCommand Stdin must be set (prompt on stdin)")
57 }
58 // Stdin should contain the prompt
59 // We can't easily read cmd.Stdin without running; just check it's non-nil (done above)
60}
61
62func TestCodexProvider_InteractiveCommand(t *testing.T) {
63 p := NewCodexProvider("codex")

Callers

nothing calls this directly

Calls 2

LoopCommandMethod · 0.95
NewCodexProviderFunction · 0.85

Tested by

no test coverage detected