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

Function TestExtractIssueNumberFromURL

pkg/cli/trial_issue_mode_test.go:9–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestExtractIssueNumberFromURL(t *testing.T) {
10 testCases := []struct {
11 name string
12 url string
13 expected string
14 }{
15 {
16 name: "Valid GitHub issue URL",
17 url: "https://github.com/github/releases/issues/6818",
18 expected: "6818",
19 },
20 {
21 name: "Another valid issue URL",
22 url: "https://github.com/github/gh-aw-trial/issues/123",
23 expected: "123",
24 },
25 {
26 name: "Issue URL with single digit",
27 url: "https://github.com/user/repo/issues/5",
28 expected: "5",
29 },
30 {
31 name: "Invalid URL - not GitHub",
32 url: "https://gitlab.com/user/repo/issues/123",
33 expected: "",
34 },
35 {
36 name: "Invalid URL - not an issue",
37 url: "https://github.com/user/repo/pulls/123",
38 expected: "",
39 },
40 {
41 name: "Invalid URL - missing issue number",
42 url: "https://github.com/user/repo/issues/",
43 expected: "",
44 },
45 {
46 name: "Invalid URL - non-numeric issue number",
47 url: "https://github.com/user/repo/issues/abc",
48 expected: "",
49 },
50 {
51 name: "Empty URL",
52 url: "",
53 expected: "",
54 },
55 {
56 name: "URL with query parameters",
57 url: "https://github.com/user/repo/issues/456?tab=comments",
58 expected: "456",
59 },
60 {
61 name: "URL with fragment",
62 url: "https://github.com/user/repo/issues/789#issuecomment-123456",
63 expected: "789",
64 },
65 }
66

Callers

nothing calls this directly

Calls 3

parseIssueSpecFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected