TestAddCommandWithWorkflow verifies that add command works with a workflow specification
(t *testing.T)
| 62 | |
| 63 | // TestAddCommandWithWorkflow verifies that add command works with a workflow specification |
| 64 | func 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 |
| 97 | func TestAddCommandHelpText(t *testing.T) { |
nothing calls this directly
no test coverage detected