(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func TestParseNumberFromURL(t *testing.T) { |
| 66 | tests := []struct { |
| 67 | name string |
| 68 | url string |
| 69 | expected int |
| 70 | }{ |
| 71 | {"PR URL", "https://github.com/owner/repo/pull/42", 42}, |
| 72 | {"issue URL", "https://github.com/owner/repo/issues/108", 108}, |
| 73 | {"comment URL", "https://github.com/owner/repo/issues/123#issuecomment-456", 123}, |
| 74 | {"empty", "", 0}, |
| 75 | {"no number", "https://github.com/owner/repo", 0}, |
| 76 | } |
| 77 | |
| 78 | for _, tt := range tests { |
| 79 | t.Run(tt.name, func(t *testing.T) { |
| 80 | assert.Equal(t, tt.expected, parseNumberFromURL(tt.url), "parsed number from URL") |
| 81 | }) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | func TestParseRepoFromURL(t *testing.T) { |
| 86 | tests := []struct { |
nothing calls this directly
no test coverage detected