MCPcopy Create free account
hub / github.com/github/gh-aw / TestAddCommandWithWorkflow

Function TestAddCommandWithWorkflow

pkg/cli/add_no_args_test.go:64–94  ·  view source on GitHub ↗

TestAddCommandWithWorkflow verifies that add command works with a workflow specification

(t *testing.T)

Source from the content-addressed store, hash-verified

62
63// TestAddCommandWithWorkflow verifies that add command works with a workflow specification
64func TestAddCommandWithWorkflow(t *testing.T) {
65 // This test verifies that the command accepts arguments correctly
66 // We don't actually execute it since that would require network access
67
68 validateEngine := func(engine string) error { return nil }
69 cmd := NewAddCommand(validateEngine)
70
71 // Verify command accepts arguments
72 if cmd.Args == nil {
73 t.Error("Add command should have Args validator")
74 }
75
76 // Test Args validator directly
77 argsValidator := cmd.Args
78 if argsValidator != nil {
79 // Should accept one argument
80 if err := argsValidator(cmd, []string{"githubnext/agentics/ci-doctor"}); err != nil {
81 t.Errorf("Command should accept one workflow argument, got error: %v", err)
82 }
83
84 // Should accept multiple arguments
85 if err := argsValidator(cmd, []string{"githubnext/agentics/ci-doctor", "githubnext/agentics/daily-plan"}); err != nil {
86 t.Errorf("Command should accept multiple workflow arguments, got error: %v", err)
87 }
88
89 // Should reject empty arguments
90 if err := argsValidator(cmd, []string{}); err == nil {
91 t.Error("Command should reject empty arguments, but no error was returned")
92 }
93 }
94}
95
96// TestAddCommandHelpText verifies the help text mentions the new command for creating workflows
97func TestAddCommandHelpText(t *testing.T) {

Callers

nothing calls this directly

Calls 3

NewAddCommandFunction · 0.85
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected