MCPcopy
hub / github.com/cli/cli / Test_runBrowse

Function Test_runBrowse

pkg/cmd/browse/browse_test.go:276–725  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

274}
275
276func Test_runBrowse(t *testing.T) {
277 s := string(os.PathSeparator)
278 t.Setenv("GIT_DIR", "../../../git/fixtures/simple.git")
279 tests := []struct {
280 name string
281 opts BrowseOptions
282 httpStub func(*httpmock.Registry)
283 baseRepo ghrepo.Interface
284 defaultBranch string
285 expectedURL string
286 wantsErr bool
287 }{
288 {
289 name: "no arguments",
290 opts: BrowseOptions{
291 SelectorArg: "",
292 },
293 baseRepo: ghrepo.New("jlsestak", "cli"),
294 expectedURL: "https://github.com/jlsestak/cli",
295 },
296 {
297 name: "settings flag",
298 opts: BrowseOptions{
299 SettingsFlag: true,
300 },
301 baseRepo: ghrepo.New("bchadwic", "ObscuredByClouds"),
302 expectedURL: "https://github.com/bchadwic/ObscuredByClouds/settings",
303 },
304 {
305 name: "projects flag",
306 opts: BrowseOptions{
307 ProjectsFlag: true,
308 },
309 baseRepo: ghrepo.New("ttran112", "7ate9"),
310 expectedURL: "https://github.com/ttran112/7ate9/projects",
311 },
312 {
313 name: "releases flag",
314 opts: BrowseOptions{
315 ReleasesFlag: true,
316 },
317 baseRepo: ghrepo.New("ttran112", "7ate9"),
318 expectedURL: "https://github.com/ttran112/7ate9/releases",
319 },
320 {
321 name: "wiki flag",
322 opts: BrowseOptions{
323 WikiFlag: true,
324 },
325 baseRepo: ghrepo.New("ravocean", "ThreatLevelMidnight"),
326 expectedURL: "https://github.com/ravocean/ThreatLevelMidnight/wiki",
327 },
328 {
329 name: "actions flag",
330 opts: BrowseOptions{
331 ActionsFlag: true,
332 },
333 baseRepo: ghrepo.New("ravocean", "ThreatLevelMidnight"),

Callers

nothing calls this directly

Calls 15

VerifyMethod · 0.95
StubRepoInfoResponseMethod · 0.95
VerifyMethod · 0.95
NewFunction · 0.92
RESTFunction · 0.92
StringResponseFunction · 0.92
TestFunction · 0.92
runBrowseFunction · 0.85
JoinMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65
RepoOwnerMethod · 0.65

Tested by

no test coverage detected