Skip to content

Commit 21691c8

Browse files
committed
Reorganized tests
1 parent 79da79f commit 21691c8

File tree

1 file changed

+41
-50
lines changed

1 file changed

+41
-50
lines changed

pkg/cmd/browse/browse_test.go

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -138,80 +138,80 @@ func Test_runBrowse(t *testing.T) {
138138
opts: BrowseOptions{
139139
SelectorArg: "",
140140
},
141-
baseRepo: ghrepo.New("jessica", "cli"),
142-
expectedURL: "https://github.com/jessica/cli",
143-
},
144-
{
145-
name: "file argument",
146-
opts: BrowseOptions{SelectorArg: "path/to/file.txt"},
147-
baseRepo: ghrepo.New("ken", "cli"),
148-
defaultBranch: "main",
149-
expectedURL: "https://github.com/ken/cli/tree/main/path/to/file.txt",
150-
},
151-
{
152-
name: "branch flag",
153-
opts: BrowseOptions{
154-
Branch: "trunk",
155-
},
156-
baseRepo: ghrepo.New("thanh", "cli"),
157-
expectedURL: "https://github.com/thanh/cli/tree/trunk/",
158-
},
159-
{
160-
name: "branch flag with file",
161-
opts: BrowseOptions{
162-
Branch: "trunk",
163-
SelectorArg: "main.go",
164-
},
165-
baseRepo: ghrepo.New("thanh", "cli"),
166-
expectedURL: "https://github.com/thanh/cli/tree/trunk/main.go",
141+
baseRepo: ghrepo.New("jlsestak", "cli"),
142+
expectedURL: "https://github.com/jlsestak/cli",
167143
},
168144
{
169145
name: "settings flag",
170146
opts: BrowseOptions{
171147
SettingsFlag: true,
172148
},
173-
baseRepo: ghrepo.New("bchadwic", "cli"),
174-
expectedURL: "https://github.com/bchadwic/cli/settings",
149+
baseRepo: ghrepo.New("bchadwic", "ObscuredByClouds"),
150+
expectedURL: "https://github.com/bchadwic/ObscuredByClouds/settings",
175151
},
176152
{
177153
name: "projects flag",
178154
opts: BrowseOptions{
179155
ProjectsFlag: true,
180156
},
181-
baseRepo: ghrepo.New("bchadwic", "cli"),
182-
expectedURL: "https://github.com/bchadwic/cli/projects",
157+
baseRepo: ghrepo.New("ttran112", "7ate9"),
158+
expectedURL: "https://github.com/ttran112/7ate9/projects",
183159
},
184160
{
185161
name: "wiki flag",
186162
opts: BrowseOptions{
187163
WikiFlag: true,
188164
},
189-
baseRepo: ghrepo.New("bchadwic", "cli"),
190-
expectedURL: "https://github.com/bchadwic/cli/wiki",
165+
baseRepo: ghrepo.New("ravocean", "ThreatLevelMidnight"),
166+
expectedURL: "https://github.com/ravocean/ThreatLevelMidnight/wiki",
167+
},
168+
{
169+
name: "file argument",
170+
opts: BrowseOptions{SelectorArg: "path/to/file.txt"},
171+
baseRepo: ghrepo.New("ken", "mrprofessor"),
172+
defaultBranch: "main",
173+
expectedURL: "https://github.com/ken/mrprofessor/tree/main/path/to/file.txt",
191174
},
192175
{
193176
name: "issue argument",
194177
opts: BrowseOptions{
195178
SelectorArg: "217",
196179
},
197-
baseRepo: ghrepo.New("bchadwic", "cli"),
198-
expectedURL: "https://github.com/bchadwic/cli/issues/217",
180+
baseRepo: ghrepo.New("kevin", "MinTy"),
181+
expectedURL: "https://github.com/kevin/MinTy/issues/217",
182+
},
183+
{
184+
name: "branch flag",
185+
opts: BrowseOptions{
186+
Branch: "trunk",
187+
},
188+
baseRepo: ghrepo.New("jlsestak", "vegan"),
189+
expectedURL: "https://github.com/jlsestak/vegan/tree/trunk/",
190+
},
191+
{
192+
name: "branch flag with file",
193+
opts: BrowseOptions{
194+
Branch: "trunk",
195+
SelectorArg: "main.go",
196+
},
197+
baseRepo: ghrepo.New("bchadwic", "LedZeppelinIV"),
198+
expectedURL: "https://github.com/bchadwic/LedZeppelinIV/tree/trunk/main.go",
199199
},
200200
{
201201
name: "file with line number",
202202
opts: BrowseOptions{
203203
SelectorArg: "path/to/file.txt:32",
204204
},
205-
baseRepo: ghrepo.New("bchadwic", "cli"),
205+
baseRepo: ghrepo.New("ravocean", "angur"),
206206
defaultBranch: "trunk",
207-
expectedURL: "https://github.com/bchadwic/cli/tree/trunk/path/to/file.txt#L32",
207+
expectedURL: "https://github.com/ravocean/angur/tree/trunk/path/to/file.txt#L32",
208208
},
209209
{
210210
name: "file with invalid line number",
211211
opts: BrowseOptions{
212212
SelectorArg: "path/to/file.txt:32:32",
213213
},
214-
baseRepo: ghrepo.New("bchadwic", "cli"),
214+
baseRepo: ghrepo.New("ttran112", "ttrain211"),
215215
wantsErr: true,
216216
},
217217
{
@@ -220,27 +220,18 @@ func Test_runBrowse(t *testing.T) {
220220
SelectorArg: "217",
221221
Branch: "trunk",
222222
},
223-
baseRepo: ghrepo.New("bchadwic", "cli"),
223+
baseRepo: ghrepo.New("ken", "grc"),
224224
wantsErr: false,
225-
expectedURL: "https://github.com/bchadwic/cli/issues/217",
225+
expectedURL: "https://github.com/ken/grc/issues/217",
226226
},
227227
{
228228
name: "opening branch",
229229
opts: BrowseOptions{
230230
Branch: "first-browse-pull",
231231
},
232-
baseRepo: ghrepo.New("ravocean", "cli"),
232+
baseRepo: ghrepo.New("github", "ThankYouGitHub"),
233233
wantsErr: false,
234-
expectedURL: "https://github.com/ravocean/cli/tree/first-browse-pull/",
235-
},
236-
{
237-
name: "file with line argument",
238-
opts: BrowseOptions{
239-
SelectorArg: "path/to/file.txt:32",
240-
},
241-
baseRepo: ghrepo.New("bchadwic", "cli"),
242-
defaultBranch: "trunk",
243-
expectedURL: "https://github.com/bchadwic/cli/tree/trunk/path/to/file.txt#L32",
234+
expectedURL: "https://github.com/github/ThankYouGitHub/tree/first-browse-pull/",
244235
},
245236
}
246237

0 commit comments

Comments
 (0)