MCPcopy
hub / github.com/cli/cli / TestRESTPrefix

Function TestRESTPrefix

internal/ghinstance/host_test.go:126–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func TestRESTPrefix(t *testing.T) {
127 tests := []struct {
128 host string
129 want string
130 }{
131 {
132 host: "github.com",
133 want: "https://api.github.com/",
134 },
135 {
136 host: "github.localhost",
137 want: "http://api.github.localhost/",
138 },
139 {
140 host: "garage.github.com",
141 want: "https://garage.github.com/api/v3/",
142 },
143 {
144 host: "ghe.io",
145 want: "https://ghe.io/api/v3/",
146 },
147 {
148 host: "tenant.ghe.com",
149 want: "https://api.tenant.ghe.com/",
150 },
151 }
152 for _, tt := range tests {
153 t.Run(tt.host, func(t *testing.T) {
154 if got := RESTPrefix(tt.host); got != tt.want {
155 t.Errorf("RESTPrefix() = %v, want %v", got, tt.want)
156 }
157 })
158 }
159}
160
161func TestCategorizeHost(t *testing.T) {
162 tests := []struct {

Callers

nothing calls this directly

Calls 3

RESTPrefixFunction · 0.85
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected