@@ -137,83 +137,101 @@ func Test_runBrowse(t *testing.T) {
137137 opts : BrowseOptions {
138138 SelectorArg : "" ,
139139 },
140- baseRepo : ghrepo .New ("jessica" , "cli" ),
141- defaultBranch : "trunk" ,
142- expectedURL : "https://github.com/jessica/cli/tree/trunk/" ,
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/" ,
140+ baseRepo : ghrepo .New ("jlsestak" , "cli" ),
141+ expectedURL : "https://github.com/jlsestak/cli" ,
158142 },
159143 {
160144 name : "settings flag" ,
161145 opts : BrowseOptions {
162146 SettingsFlag : true ,
163147 },
164- baseRepo : ghrepo .New ("bchadwic" , "cli " ),
165- expectedURL : "https://github.com/bchadwic/cli /settings" ,
148+ baseRepo : ghrepo .New ("bchadwic" , "ObscuredByClouds " ),
149+ expectedURL : "https://github.com/bchadwic/ObscuredByClouds /settings" ,
166150 },
167151 {
168152 name : "projects flag" ,
169153 opts : BrowseOptions {
170154 ProjectsFlag : true ,
171155 },
172- baseRepo : ghrepo .New ("bchadwic " , "cli " ),
173- expectedURL : "https://github.com/bchadwic/cli /projects" ,
156+ baseRepo : ghrepo .New ("ttran112 " , "7ate9 " ),
157+ expectedURL : "https://github.com/ttran112/7ate9 /projects" ,
174158 },
175159 {
176160 name : "wiki flag" ,
177161 opts : BrowseOptions {
178162 WikiFlag : true ,
179163 },
180- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
181- expectedURL : "https://github.com/bchadwic/cli/wiki" ,
164+ baseRepo : ghrepo .New ("ravocean" , "ThreatLevelMidnight" ),
165+ expectedURL : "https://github.com/ravocean/ThreatLevelMidnight/wiki" ,
166+ },
167+ {
168+ name : "file argument" ,
169+ opts : BrowseOptions {SelectorArg : "path/to/file.txt" },
170+ baseRepo : ghrepo .New ("ken" , "mrprofessor" ),
171+ defaultBranch : "main" ,
172+ expectedURL : "https://github.com/ken/mrprofessor/tree/main/path/to/file.txt" ,
182173 },
183174 {
184175 name : "issue argument" ,
185176 opts : BrowseOptions {
186177 SelectorArg : "217" ,
187178 },
188- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
189- expectedURL : "https://github.com/bchadwic/cli/issues/217" ,
179+ baseRepo : ghrepo .New ("kevin" , "MinTy" ),
180+ expectedURL : "https://github.com/kevin/MinTy/issues/217" ,
181+ },
182+ {
183+ name : "branch flag" ,
184+ opts : BrowseOptions {
185+ Branch : "trunk" ,
186+ },
187+ baseRepo : ghrepo .New ("jlsestak" , "CouldNotThinkOfARepoName" ),
188+ expectedURL : "https://github.com/jlsestak/CouldNotThinkOfARepoName/tree/trunk/" ,
189+ },
190+ {
191+ name : "branch flag with file" ,
192+ opts : BrowseOptions {
193+ Branch : "trunk" ,
194+ SelectorArg : "main.go" ,
195+ },
196+ baseRepo : ghrepo .New ("bchadwic" , "LedZeppelinIV" ),
197+ expectedURL : "https://github.com/bchadwic/LedZeppelinIV/tree/trunk/main.go" ,
190198 },
191199 {
192200 name : "file with line number" ,
193201 opts : BrowseOptions {
194202 SelectorArg : "path/to/file.txt:32" ,
195203 },
196- baseRepo : ghrepo .New ("bchadwic " , "cli " ),
204+ baseRepo : ghrepo .New ("ravocean " , "angur " ),
197205 defaultBranch : "trunk" ,
198- expectedURL : "https://github.com/bchadwic/cli /tree/trunk/path/to/file.txt#L32" ,
206+ expectedURL : "https://github.com/ravocean/angur /tree/trunk/path/to/file.txt#L32" ,
199207 },
200208 {
201209 name : "file with invalid line number" ,
202210 opts : BrowseOptions {
203211 SelectorArg : "path/to/file.txt:32:32" ,
204212 },
205- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
206- defaultBranch : "trunk" ,
207- wantsErr : true ,
213+ baseRepo : ghrepo .New ("ttran112" , "ttrain211" ),
214+ wantsErr : true ,
208215 },
209216 {
210- name : "file with line argument " ,
217+ name : "branch with issue number " ,
211218 opts : BrowseOptions {
212- SelectorArg : "path/to/file.txt:32" ,
219+ SelectorArg : "217" ,
220+ Branch : "trunk" ,
213221 },
214- baseRepo : ghrepo .New ("bchadwic" , "cli" ),
215- defaultBranch : "trunk" ,
216- expectedURL : "https://github.com/bchadwic/cli/tree/trunk/path/to/file.txt#L32" ,
222+ baseRepo : ghrepo .New ("ken" , "grc" ),
223+ wantsErr : false ,
224+ expectedURL : "https://github.com/ken/grc/issues/217" ,
225+ },
226+ {
227+ name : "opening branch file with line number" ,
228+ opts : BrowseOptions {
229+ Branch : "first-browse-pull" ,
230+ SelectorArg : "browse.go:32" ,
231+ },
232+ baseRepo : ghrepo .New ("github" , "ThankYouGitHub" ),
233+ wantsErr : false ,
234+ expectedURL : "https://github.com/github/ThankYouGitHub/tree/first-browse-pull/browse.go#L32" ,
217235 },
218236 }
219237
0 commit comments