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

Function TestAddWorkflows

pkg/cli/add_command_test.go:94–130  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestAddWorkflows(t *testing.T) {
95 tests := []struct {
96 name string
97 workflows []string
98 expectError bool
99 errorContains string
100 }{
101 {
102 name: "empty workflows list",
103 workflows: []string{},
104 expectError: true,
105 errorContains: "at least one workflow",
106 },
107 {
108 name: "invalid repo spec missing repo name",
109 workflows: []string{"owner"},
110 expectError: true,
111 errorContains: "not a valid workflow path or repository package",
112 },
113 }
114
115 for _, tt := range tests {
116 t.Run(tt.name, func(t *testing.T) {
117 opts := AddOptions{}
118 _, err := AddWorkflows(context.Background(), tt.workflows, opts)
119
120 if tt.expectError {
121 require.Error(t, err, "Expected error for test case: %s", tt.name)
122 if tt.errorContains != "" {
123 assert.Contains(t, err.Error(), tt.errorContains, "Error should contain expected message")
124 }
125 } else {
126 assert.NoError(t, err, "Should not error for test case: %s", tt.name)
127 }
128 })
129 }
130}
131
132// TestAddCommandStructure removed - redundant with TestNewAddCommand
133

Callers

nothing calls this directly

Calls 4

AddWorkflowsFunction · 0.85
BackgroundMethod · 0.80
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected