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

Function TestSpec_PublicAPI_ValidateWorkflowName

pkg/cli/spec_test.go:17–40  ·  view source on GitHub ↗

TestSpec_PublicAPI_ValidateWorkflowName validates the documented behavior. Spec: empty names and names with invalid characters return errors.

(t *testing.T)

Source from the content-addressed store, hash-verified

15// TestSpec_PublicAPI_ValidateWorkflowName validates the documented behavior.
16// Spec: empty names and names with invalid characters return errors.
17func TestSpec_PublicAPI_ValidateWorkflowName(t *testing.T) {
18 tests := []struct {
19 name string
20 input string
21 wantErr bool
22 }{
23 {name: "valid alphanumeric-hyphen name", input: "my-workflow", wantErr: false},
24 {name: "valid name with underscores and digits", input: "my_workflow_123", wantErr: false},
25 {name: "empty name returns error", input: "", wantErr: true},
26 {name: "name with spaces returns error", input: "my workflow", wantErr: true},
27 {name: "name with slashes returns error", input: "my/workflow", wantErr: true},
28 }
29
30 for _, tt := range tests {
31 t.Run(tt.name, func(t *testing.T) {
32 err := cli.ValidateWorkflowName(tt.input)
33 if tt.wantErr {
34 assert.Error(t, err, "ValidateWorkflowName(%q) should return an error", tt.input)
35 } else {
36 assert.NoError(t, err, "ValidateWorkflowName(%q) should not return an error", tt.input)
37 }
38 })
39 }
40}
41
42// TestSpec_PublicAPI_IsCommitSHA validates that IsCommitSHA returns true only for 40-char hex strings.
43// Spec: "Returns true if the string is a full Git commit SHA"

Callers

nothing calls this directly

Calls 3

ValidateWorkflowNameFunction · 0.92
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected