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

Function TestGenericURLWorkflowName

pkg/cli/jsonworkflow_to_markdown_test.go:318–339  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

316}
317
318func 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
341func TestRewriteAutomationsURL(t *testing.T) {
342 tests := []struct {

Callers

nothing calls this directly

Calls 2

genericURLWorkflowNameFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected