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

Function TestParseRepoFileURL

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

Source from the content-addressed store, hash-verified

668}
669
670func TestParseRepoFileURL(t *testing.T) {
671 tests := []struct {
672 name string
673 url string
674 wantOwner string
675 wantRepo string
676 wantRef string
677 wantPath string
678 wantErr bool
679 }{
680 {
681 name: "Blob URL",
682 url: "https://github.com/owner/repo/blob/main/path/to/file.md",
683 wantOwner: "owner",
684 wantRepo: "repo",
685 wantRef: "main",
686 wantPath: "path/to/file.md",
687 wantErr: false,
688 },
689 {
690 name: "Tree URL",
691 url: "https://github.com/owner/repo/tree/develop/src",
692 wantOwner: "owner",
693 wantRepo: "repo",
694 wantRef: "develop",
695 wantPath: "src",
696 wantErr: false,
697 },
698 {
699 name: "Raw URL",
700 url: "https://github.com/owner/repo/raw/v1.0.0/README.md",
701 wantOwner: "owner",
702 wantRepo: "repo",
703 wantRef: "v1.0.0",
704 wantPath: "README.md",
705 wantErr: false,
706 },
707 {
708 name: "Raw githubusercontent URL",
709 url: "https://raw.githubusercontent.com/owner/repo/main/path/to/file.md",
710 wantOwner: "owner",
711 wantRepo: "repo",
712 wantRef: "main",
713 wantPath: "path/to/file.md",
714 wantErr: false,
715 },
716 {
717 name: "Raw githubusercontent with refs/heads",
718 url: "https://raw.githubusercontent.com/owner/repo/refs/heads/feature/path/file.md",
719 wantOwner: "owner",
720 wantRepo: "repo",
721 wantRef: "feature",
722 wantPath: "path/file.md",
723 wantErr: false,
724 },
725 {
726 name: "Not a file URL - PR",
727 url: "https://github.com/owner/repo/pull/123",

Callers

nothing calls this directly

Calls 3

ParseRepoFileURLFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected