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

Function TestParsePRURL

pkg/parser/github_urls_test.go:576–668  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

574}
575
576func TestParsePRURL(t *testing.T) {
577 tests := []struct {
578 name string
579 url string
580 wantOwner string
581 wantRepo string
582 wantPR int
583 wantErr bool
584 }{
585 {
586 name: "Valid GitHub PR URL",
587 url: "https://github.com/trial/repo/pull/234",
588 wantOwner: "trial",
589 wantRepo: "repo",
590 wantPR: 234,
591 wantErr: false,
592 },
593 {
594 name: "Valid GitHub PR URL with hyphenated repo name",
595 url: "https://github.com/PR-OWNER/PR-REPO/pull/456",
596 wantOwner: "PR-OWNER",
597 wantRepo: "PR-REPO",
598 wantPR: 456,
599 wantErr: false,
600 },
601 {
602 name: "Valid GitHub PR URL with underscores",
603 url: "https://github.com/test_owner/test_repo/pull/789",
604 wantOwner: "test_owner",
605 wantRepo: "test_repo",
606 wantPR: 789,
607 wantErr: false,
608 },
609 {
610 name: "Invalid URL format",
611 url: "not-a-url",
612 wantErr: true,
613 },
614 {
615 name: "Enterprise GitHub URL now accepted",
616 url: "https://github.example.com/owner/repo/pull/123",
617 wantOwner: "owner",
618 wantRepo: "repo",
619 wantPR: 123,
620 wantErr: false,
621 },
622 {
623 name: "Invalid GitHub URL path - missing pull",
624 url: "https://github.com/owner/repo/123",
625 wantErr: true,
626 },
627 {
628 name: "Invalid GitHub URL path - wrong format",
629 url: "https://github.com/owner/repo/pulls/123",
630 wantErr: true,
631 },
632 {
633 name: "Invalid PR number",

Callers

nothing calls this directly

Calls 3

ParsePRURLFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected