package inbox import ( "strings" "testing" ) // TestInboxRootHelpExplainsWorkerLoop verifies inbox root help explains worker loop. 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) } } // TestInboxUpdateHelpExplainsBlockedQuestions verifies inbox update help explains blocked questions. 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) } } // TestInboxWaitReplyHelpExplainsBlockingPrimitive verifies inbox wait reply help explains blocking primitive. 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) } } // TestInboxListHelpExplainsDifferenceFromFetch verifies inbox list help explains difference from fetch. 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) } }