84 lines
2.9 KiB
Go
84 lines
2.9 KiB
Go
package inbox
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestInboxRootHelpExplainsWorkerLoop(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
stdout, stderr, exitCode := executeInboxCommand("--help")
|
|
if exitCode != 0 {
|
|
t.Fatalf("expected help exit 0, got %d\nstderr:\n%s\nstdout:\n%s", exitCode, stderr, stdout)
|
|
}
|
|
|
|
combined := stdout + stderr
|
|
if !strings.Contains(combined, "Workers should use inbox directly") {
|
|
t.Fatalf("expected root help to explain worker role, got:\n%s", combined)
|
|
}
|
|
if !strings.Contains(combined, "Constraints:") {
|
|
t.Fatalf("expected root help to include constraints section, got:\n%s", combined)
|
|
}
|
|
if !strings.Contains(combined, "fetch --agent worker-a --status pending") {
|
|
t.Fatalf("expected root help to include a concrete workflow example, got:\n%s", combined)
|
|
}
|
|
}
|
|
|
|
func TestInboxUpdateHelpExplainsBlockedQuestions(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
stdout, stderr, exitCode := executeInboxCommand("update", "--help")
|
|
if exitCode != 0 {
|
|
t.Fatalf("expected help exit 0, got %d\nstderr:\n%s\nstdout:\n%s", exitCode, stderr, stdout)
|
|
}
|
|
|
|
combined := stdout + stderr
|
|
if !strings.Contains(combined, "Blocked updates should include") {
|
|
t.Fatalf("expected update help to explain blocked questions, got:\n%s", combined)
|
|
}
|
|
if !strings.Contains(combined, "Constraints:") {
|
|
t.Fatalf("expected update help to include constraints section, got:\n%s", combined)
|
|
}
|
|
if !strings.Contains(combined, `--payload-json '{"question":"Use stdout or stderr?"}'`) {
|
|
t.Fatalf("expected update help to include payload-json example, got:\n%s", combined)
|
|
}
|
|
}
|
|
|
|
func TestInboxWaitReplyHelpExplainsBlockingPrimitive(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
stdout, stderr, exitCode := executeInboxCommand("wait-reply", "--help")
|
|
if exitCode != 0 {
|
|
t.Fatalf("expected help exit 0, got %d\nstderr:\n%s\nstdout:\n%s", exitCode, stderr, stdout)
|
|
}
|
|
|
|
combined := stdout + stderr
|
|
if !strings.Contains(combined, "worker-side blocking primitive") {
|
|
t.Fatalf("expected wait-reply help to explain its role, got:\n%s", combined)
|
|
}
|
|
if !strings.Contains(combined, "--after-event 42 --timeout-seconds 900") {
|
|
t.Fatalf("expected wait-reply help to include resume example, got:\n%s", combined)
|
|
}
|
|
}
|
|
|
|
func TestInboxListHelpExplainsDifferenceFromFetch(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
stdout, stderr, exitCode := executeInboxCommand("list", "--help")
|
|
if exitCode != 0 {
|
|
t.Fatalf("expected help exit 0, got %d\nstderr:\n%s\nstdout:\n%s", exitCode, stderr, stdout)
|
|
}
|
|
|
|
combined := stdout + stderr
|
|
if !strings.Contains(combined, "Compared with fetch") {
|
|
t.Fatalf("expected list help to explain how it differs from fetch, got:\n%s", combined)
|
|
}
|
|
if !strings.Contains(combined, "Constraints:") {
|
|
t.Fatalf("expected list help to include constraints section, got:\n%s", combined)
|
|
}
|
|
if !strings.Contains(combined, "--created-by orch --status done,failed") {
|
|
t.Fatalf("expected list help to include inspection-focused example, got:\n%s", combined)
|
|
}
|
|
}
|