(t *testing.T)
| 316 | } |
| 317 | |
| 318 | func TestGenericURLWorkflowName(t *testing.T) { |
| 319 | tests := []struct { |
| 320 | url string |
| 321 | want string |
| 322 | }{ |
| 323 | {"https://example.com/my-workflow.md", "my-workflow"}, |
| 324 | {"https://example.com/workflows/daily-report.json", "daily-report"}, |
| 325 | {"https://example.com/", "imported-workflow"}, |
| 326 | {"https://example.com/workflow.yaml", "workflow"}, |
| 327 | // url.Parse treats bare strings as relative paths; "not-a-url" has no extension. |
| 328 | {"not-a-url", "not-a-url"}, |
| 329 | // Spaces and mixed-case should be kebab-cased. |
| 330 | {"https://example.com/My%20Workflow.json", "my-workflow"}, |
| 331 | {"https://example.com/My_Workflow.md", "my-workflow"}, |
| 332 | {"https://example.com/Weekly Report.json", "weekly-report"}, |
| 333 | } |
| 334 | for _, tc := range tests { |
| 335 | t.Run(tc.url, func(t *testing.T) { |
| 336 | assert.Equal(t, tc.want, genericURLWorkflowName(tc.url)) |
| 337 | }) |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | func TestRewriteAutomationsURL(t *testing.T) { |
| 342 | tests := []struct { |
nothing calls this directly
no test coverage detected