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

Function TestAddMultipleWorkflowsNameFlag

pkg/cli/add_command_test.go:358–367  ·  view source on GitHub ↗

TestAddMultipleWorkflowsNameFlag verifies that --name is not allowed when multiple workflows are specified.

(t *testing.T)

Source from the content-addressed store, hash-verified

356
357// TestAddMultipleWorkflowsNameFlag verifies that --name is not allowed when multiple workflows are specified.
358func TestAddMultipleWorkflowsNameFlag(t *testing.T) {
359 cmd := NewAddCommand(validateEngineStub)
360
361 // Simulate calling the command with --name and multiple workflow arguments
362 cmd.SetArgs([]string{"workflow1", "workflow2", "--name", "custom-name"})
363
364 err := cmd.Execute()
365 require.Error(t, err, "Should error when --name is used with multiple workflows")
366 assert.Contains(t, err.Error(), "--name flag cannot be used when adding multiple workflows", "Error should mention --name restriction")
367}
368
369// setupMinimalGitRepo initialises a bare-minimum git repo in dir and returns the
370// path to the .github/workflows directory so callers can write/read workflow files.

Callers

nothing calls this directly

Calls 2

NewAddCommandFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected