Skip to content

Commit 05511c1

Browse files
authored
Merge pull request cli#45 from jlsestak/trunk
Made more runBrowse tests
2 parents 2b42ab9 + edef757 commit 05511c1

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

pkg/cmd/browse/browse_test.go

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,24 @@ func Test_runBrowse(t *testing.T) {
4545
opts: BrowseOptions{
4646
SelectorArg: "",
4747
},
48-
baseRepo: ghrepo.New("jessica", "cli"),
49-
expectedURL: "https://github.com/jessica/cli",
48+
baseRepo: ghrepo.New("jessica", "cli"),
49+
defaultBranch: "trunk",
50+
expectedURL: "https://github.com/jessica/cli/tree/trunk/",
5051
},
5152
{
5253
name: "file argument",
5354
opts: BrowseOptions{SelectorArg: "path/to/file.txt"},
54-
baseRepo: ghrepo.New("bchadwic", "cli"),
55+
baseRepo: ghrepo.New("ken", "cli"),
5556
defaultBranch: "main",
56-
expectedURL: "https://github.com/bchadwic/cli/tree/main/path/to/file.txt",
57+
expectedURL: "https://github.com/ken/cli/tree/main/path/to/file.txt",
5758
},
5859
{
5960
name: "branch flag",
6061
opts: BrowseOptions{
6162
Branch: "trunk",
6263
},
63-
baseRepo: ghrepo.New("bchadwic", "cli"),
64-
expectedURL: "https://github.com/bchadwic/cli/tree/trunk",
64+
baseRepo: ghrepo.New("thanh", "cli"),
65+
expectedURL: "https://github.com/thanh/cli/tree/trunk/",
6566
},
6667
{
6768
name: "settings flag",
@@ -71,7 +72,32 @@ func Test_runBrowse(t *testing.T) {
7172
baseRepo: ghrepo.New("bchadwic", "cli"),
7273
expectedURL: "https://github.com/bchadwic/cli/settings",
7374
},
75+
{
76+
name: "projects flag",
77+
opts: BrowseOptions{
78+
ProjectsFlag: true,
79+
},
80+
baseRepo: ghrepo.New("bchadwic", "cli"),
81+
expectedURL: "https://github.com/bchadwic/cli/projects",
82+
},
83+
{
84+
name: "wiki flag",
85+
opts: BrowseOptions{
86+
WikiFlag: true,
87+
},
88+
baseRepo: ghrepo.New("bchadwic", "cli"),
89+
expectedURL: "https://github.com/bchadwic/cli/wiki",
90+
},
91+
{
92+
name: "issue argument",
93+
opts: BrowseOptions{
94+
SelectorArg: "217",
95+
},
96+
baseRepo: ghrepo.New("bchadwic", "cli"),
97+
expectedURL: "https://github.com/bchadwic/cli/issues/217",
98+
},
7499
}
100+
75101
for _, tt := range tests {
76102
t.Run(tt.name, func(t *testing.T) {
77103
io, _, stdout, stderr := iostreams.Test()

0 commit comments

Comments
 (0)