(t *testing.T)
| 467 | } |
| 468 | |
| 469 | func TestSanitizeName_NilOptions(t *testing.T) { |
| 470 | tests := []struct { |
| 471 | name string |
| 472 | input string |
| 473 | expected string |
| 474 | }{ |
| 475 | { |
| 476 | name: "nil options - empty string", |
| 477 | input: "", |
| 478 | expected: "", |
| 479 | }, |
| 480 | { |
| 481 | name: "nil options - only hyphens", |
| 482 | input: "---", |
| 483 | expected: "-", // Multiple hyphens consolidated to single hyphen |
| 484 | }, |
| 485 | { |
| 486 | name: "nil options - leading/trailing hyphens", |
| 487 | input: "-workflow-", |
| 488 | expected: "-workflow-", // Preserved with nil opts (TrimHyphens is false) |
| 489 | }, |
| 490 | { |
| 491 | name: "nil options - underscores replaced", |
| 492 | input: "test_workflow_name", |
| 493 | expected: "test-workflow-name", // Underscores replaced when not in PreserveSpecialChars |
| 494 | }, |
| 495 | { |
| 496 | name: "nil options - dots removed", |
| 497 | input: "workflow.test.name", |
| 498 | expected: "workflowtestname", // Dots removed when PreserveSpecialChars is empty |
| 499 | }, |
| 500 | { |
| 501 | name: "nil options - complex name", |
| 502 | input: "Test_Workflow.Name@123", |
| 503 | expected: "test-workflowname123", // Special chars removed when PreserveSpecialChars is empty |
| 504 | }, |
| 505 | { |
| 506 | name: "nil options - multiple special characters", |
| 507 | input: "workflow@#$%test", |
| 508 | expected: "workflowtest", // Special chars removed when PreserveSpecialChars is empty |
| 509 | }, |
| 510 | } |
| 511 | |
| 512 | for _, tt := range tests { |
| 513 | t.Run(tt.name, func(t *testing.T) { |
| 514 | result := SanitizeName(tt.input, nil) |
| 515 | assert.Equal(t, tt.expected, result, "SanitizeName with nil options failed for test case: %s", tt.name) |
| 516 | }) |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | func TestGenerateHeredocDelimiterFromContent_Stability(t *testing.T) { |
| 521 | content := `{"key":"value","items":[1,2,3]}` |
nothing calls this directly
no test coverage detected