(t *testing.T)
| 635 | } |
| 636 | |
| 637 | func TestSanitizeWorkflowName(t *testing.T) { |
| 638 | tests := []struct { |
| 639 | name string |
| 640 | input string |
| 641 | expected string |
| 642 | }{ |
| 643 | { |
| 644 | name: "lowercase conversion", |
| 645 | input: "MyWorkflow", |
| 646 | expected: "myworkflow", |
| 647 | }, |
| 648 | { |
| 649 | name: "spaces to dashes", |
| 650 | input: "My Workflow Name", |
| 651 | expected: "my-workflow-name", |
| 652 | }, |
| 653 | { |
| 654 | name: "colons to dashes", |
| 655 | input: "workflow:test", |
| 656 | expected: "workflow-test", |
| 657 | }, |
| 658 | { |
| 659 | name: "slashes to dashes", |
| 660 | input: "workflow/test", |
| 661 | expected: "workflow-test", |
| 662 | }, |
| 663 | { |
| 664 | name: "backslashes to dashes", |
| 665 | input: "workflow\\test", |
| 666 | expected: "workflow-test", |
| 667 | }, |
| 668 | { |
| 669 | name: "special characters to dashes", |
| 670 | input: "workflow@#$test", |
| 671 | expected: "workflow-test", |
| 672 | }, |
| 673 | { |
| 674 | name: "preserve dots and underscores", |
| 675 | input: "workflow.test_name", |
| 676 | expected: "workflow.test_name", |
| 677 | }, |
| 678 | { |
| 679 | name: "complex name", |
| 680 | input: "My Workflow: Test/Build", |
| 681 | expected: "my-workflow-test-build", |
| 682 | }, |
| 683 | } |
| 684 | |
| 685 | for _, tt := range tests { |
| 686 | t.Run(tt.name, func(t *testing.T) { |
| 687 | result := workflow.SanitizeWorkflowName(tt.input) |
| 688 | if result != tt.expected { |
| 689 | t.Errorf("SanitizeWorkflowName(%q) = %q, want %q", tt.input, result, tt.expected) |
| 690 | } |
| 691 | }) |
| 692 | } |
| 693 | } |
| 694 |
nothing calls this directly
no test coverage detected