TestSpec_PublicAPI_ValidateWorkflowName validates the documented behavior. Spec: empty names and names with invalid characters return errors.
(t *testing.T)
| 15 | // TestSpec_PublicAPI_ValidateWorkflowName validates the documented behavior. |
| 16 | // Spec: empty names and names with invalid characters return errors. |
| 17 | func 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" |
nothing calls this directly
no test coverage detected