MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / TestResolveStepInputWithOverride

Function TestResolveStepInputWithOverride

internal/cli/workflow_test.go:218–260  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

216}
217
218func TestResolveStepInputWithOverride(t *testing.T) {
219 carried := "previous step output"
220
221 tests := []struct {
222 name string
223 step WorkflowStep
224 wantInput string
225 wantOverride bool
226 }{
227 {
228 name: "no input field -> carried through",
229 step: WorkflowStep{Pattern: "p"},
230 wantInput: carried,
231 },
232 {
233 name: "explicit input overrides carried",
234 step: WorkflowStep{Pattern: "p", Input: " custom text "},
235 wantInput: "custom text",
236 wantOverride: true,
237 },
238 {
239 name: "whitespace-only input is NOT an override",
240 step: WorkflowStep{Pattern: "p", Input: " \n\t "},
241 wantInput: carried,
242 },
243 {
244 name: "empty string is NOT an override",
245 step: WorkflowStep{Pattern: "p", Input: ""},
246 wantInput: carried,
247 },
248 }
249 for _, tc := range tests {
250 t.Run(tc.name, func(t *testing.T) {
251 got, overridden := resolveStepInputWithOverride(tc.step, carried)
252 if got != tc.wantInput {
253 t.Errorf("input = %q, want %q", got, tc.wantInput)
254 }
255 if overridden != tc.wantOverride {
256 t.Errorf("overridden = %v, want %v", overridden, tc.wantOverride)
257 }
258 })
259 }
260}
261
262func TestMergeVars(t *testing.T) {
263 got := mergeVars(

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected