@@ -138,83 +138,100 @@ func Test_runBrowse(t *testing.T) {
138138 opts : BrowseOptions {
139139 SelectorArg : "" ,
140140 },
141- baseRepo : ghrepo .New ("jessica" , "cli" ),
142- defaultBranch : "trunk" ,
143- expectedURL : "https://github.com/jessica/cli/tree/trunk/" ,
144- },
145- {
146- name : "file argument" ,
147- opts : BrowseOptions {SelectorArg : "path/to/file.txt" },
148- baseRepo : ghrepo .New ("ken" , "cli" ),
149- defaultBranch : "main" ,
150- expectedURL : "https://github.com/ken/cli/tree/main/path/to/file.txt" ,
151- },
152- {
153- name : "branch flag" ,
154- opts : BrowseOptions {
155- Branch : "trunk" ,
156- },
157- baseRepo : ghrepo .New ("thanh" , "cli" ),
158- expectedURL : "https://github.com/thanh/cli/tree/trunk/" ,
141+ baseRepo : ghrepo .New ("jlsestak" , "cli" ),
142+ expectedURL : "https://github.com/jlsestak/cli" ,
159143 },
160144 {
161145 name : "settings flag" ,
162146 opts : BrowseOptions {
163147 SettingsFlag : true ,
164148 },
165- baseRepo : ghrepo .New ("bchadwic" , "cli " ),
166- expectedURL : "https://github.com/bchadwic/cli /settings" ,
149+ baseRepo : ghrepo .New ("bchadwic" , "ObscuredByClouds " ),
150+ expectedURL : "https://github.com/bchadwic/ObscuredByClouds /settings" ,
167151 },
168152 {
169153 name : "projects flag" ,
170154 opts : BrowseOptions {
171155 ProjectsFlag : true ,
172156 },
173- baseRepo : ghrepo .New ("bchadwic " , "cli " ),
174- expectedURL : "https://github.com/bchadwic/cli /projects" ,
157+ baseRepo : ghrepo .New ("ttran112 " , "7ate9 " ),
158+ expectedURL : "https://github.com/ttran112/7ate9 /projects" ,
175159 },
176160 {
177161 name : "wiki flag" ,
178162 opts : BrowseOptions {
179163 WikiFlag : true ,
180164 },
181- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
182- 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" ,
183174 },
184175 {
185176 name : "issue argument" ,
186177 opts : BrowseOptions {
187178 SelectorArg : "217" ,
188179 },
189- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
190- 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" ,
191199 },
192200 {
193201 name : "file with line number" ,
194202 opts : BrowseOptions {
195203 SelectorArg : "path/to/file.txt:32" ,
196204 },
197- baseRepo : ghrepo .New ("bchadwic " , "cli " ),
205+ baseRepo : ghrepo .New ("ravocean " , "angur " ),
198206 defaultBranch : "trunk" ,
199- 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" ,
200208 },
201209 {
202210 name : "file with invalid line number" ,
203211 opts : BrowseOptions {
204212 SelectorArg : "path/to/file.txt:32:32" ,
205213 },
206- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
207- defaultBranch : "trunk" ,
208- wantsErr : true ,
214+ baseRepo : ghrepo .New ("ttran112" , "ttrain211" ),
215+ wantsErr : true ,
209216 },
210217 {
211- name : "file with line argument " ,
218+ name : "branch with issue number " ,
212219 opts : BrowseOptions {
213- SelectorArg : "path/to/file.txt:32" ,
220+ SelectorArg : "217" ,
221+ Branch : "trunk" ,
214222 },
215- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
216- defaultBranch : "trunk" ,
217- expectedURL : "https://github.com/bchadwic/cli/tree/trunk/path/to/file.txt#L32" ,
223+ baseRepo : ghrepo .New ("ken" , "grc" ),
224+ wantsErr : false ,
225+ expectedURL : "https://github.com/ken/grc/issues/217" ,
226+ },
227+ {
228+ name : "opening branch" ,
229+ opts : BrowseOptions {
230+ Branch : "first-browse-pull" ,
231+ },
232+ baseRepo : ghrepo .New ("github" , "ThankYouGitHub" ),
233+ wantsErr : false ,
234+ expectedURL : "https://github.com/github/ThankYouGitHub/tree/first-browse-pull/" ,
218235 },
219236 }
220237
0 commit comments