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

Function TestValidateWorkflowName

pkg/cli/validators_test.go:10–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestValidateWorkflowName(t *testing.T) {
11 tests := []struct {
12 name string
13 input string
14 expectError bool
15 errorMsg string
16 }{
17 {
18 name: "valid simple name",
19 input: "my-workflow",
20 expectError: false,
21 },
22 {
23 name: "valid with underscores",
24 input: "my_workflow",
25 expectError: false,
26 },
27 {
28 name: "valid alphanumeric",
29 input: "workflow123",
30 expectError: false,
31 },
32 {
33 name: "valid mixed",
34 input: "my-workflow_v2",
35 expectError: false,
36 },
37 {
38 name: "valid uppercase",
39 input: "MyWorkflow",
40 expectError: false,
41 },
42 {
43 name: "valid all hyphens and underscores",
44 input: "my-workflow_test-123",
45 expectError: false,
46 },
47 {
48 name: "empty string",
49 input: "",
50 expectError: true,
51 errorMsg: "workflow name cannot be empty",
52 },
53 {
54 name: "invalid with spaces",
55 input: "my workflow",
56 expectError: true,
57 errorMsg: "workflow name must contain only alphanumeric characters, hyphens, and underscores",
58 },
59 {
60 name: "invalid with special chars",
61 input: "my@workflow!",
62 expectError: true,
63 errorMsg: "workflow name must contain only alphanumeric characters, hyphens, and underscores",
64 },
65 {
66 name: "invalid with dots",
67 input: "my.workflow",

Callers

nothing calls this directly

Calls 4

ValidateWorkflowNameFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected