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

Function TestValidateWorkflowInputs

pkg/cli/run_input_validation_test.go:117–353  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func TestValidateWorkflowInputs(t *testing.T) {
118 tests := []struct {
119 name string
120 lockContent string
121 providedInputs []string
122 expectError bool
123 errorContains []string // strings that should be in the error message
124 errorNotContains []string // strings that should NOT be in the error message
125 }{
126 {
127 name: "all required inputs provided",
128 lockContent: `name: "Test Workflow"
129on:
130 workflow_dispatch:
131 inputs:
132 issue_url:
133 description: 'Issue URL'
134 required: true
135 type: string
136jobs:
137 test:
138 runs-on: ubuntu-latest
139 steps:
140 - run: echo "test"
141`,
142 providedInputs: []string{"issue_url=https://github.com/owner/repo/issues/123"},
143 expectError: false,
144 },
145 {
146 name: "missing required input",
147 lockContent: `name: "Test Workflow"
148on:
149 workflow_dispatch:
150 inputs:
151 issue_url:
152 description: 'Issue URL'
153 required: true
154 type: string
155jobs:
156 test:
157 runs-on: ubuntu-latest
158 steps:
159 - run: echo "test"
160`,
161 providedInputs: []string{},
162 expectError: true,
163 errorContains: []string{"Missing required input(s)", "issue_url", "gh aw run test-workflow -F issue_url=<value>"},
164 },
165 {
166 name: "required input with default value - should not error when missing",
167 lockContent: `name: "Test Workflow"
168on:
169 workflow_dispatch:
170 inputs:
171 release_type:
172 description: 'Release type'
173 required: true
174 default: patch

Callers

nothing calls this directly

Calls 4

validateWorkflowInputsFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected