MCPcopy
hub / github.com/cli/cli / Test_translateRemotes

Function Test_translateRemotes

context/remote_test.go:102–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func Test_translateRemotes(t *testing.T) {
103 publicURL, _ := url.Parse("https://github.com/monalisa/hello")
104 originURL, _ := url.Parse("http://example.com/repo")
105
106 gitRemotes := git.RemoteSet{
107 &git.Remote{
108 Name: "origin",
109 FetchURL: originURL,
110 },
111 &git.Remote{
112 Name: "public",
113 FetchURL: publicURL,
114 },
115 }
116
117 result := TranslateRemotes(gitRemotes, identityTranslator{})
118
119 if len(result) != 1 {
120 t.Errorf("got %d results", len(result))
121 }
122 if result[0].Name != "public" {
123 t.Errorf("got %q", result[0].Name)
124 }
125 if result[0].RepoName() != "hello" {
126 t.Errorf("got %q", result[0].RepoName())
127 }
128}
129
130func Test_FilterByHosts(t *testing.T) {
131 r1 := &Remote{Remote: &git.Remote{Name: "mona"}, Repo: ghrepo.NewWithHost("monalisa", "myfork", "test.com")}

Callers

nothing calls this directly

Calls 3

TranslateRemotesFunction · 0.85
ErrorfMethod · 0.65
RepoNameMethod · 0.65

Tested by

no test coverage detected