(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func 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 | |
| 130 | func Test_FilterByHosts(t *testing.T) { |
| 131 | r1 := &Remote{Remote: &git.Remote{Name: "mona"}, Repo: ghrepo.NewWithHost("monalisa", "myfork", "test.com")} |
nothing calls this directly
no test coverage detected