@@ -150,6 +150,47 @@ suite("Github", async () => {
150150 assert . deepEqual ( result , expected )
151151 }
152152 } )
153+ test ( "if we have no selection on the first line, don't select anything" , async ( ) => {
154+ for ( let url of [
155+ "git@github.mycompany.com:recipeyak/recipeyak.git" ,
156+ "git@github.mycompany.com:recipeyak/recipeyak" ,
157+ "org-XYZ123@github.mycompany.com:recipeyak/recipeyak" ,
158+ "ssh://git@github.mycompany.com/recipeyak/recipeyak.git" ,
159+ ] ) {
160+ async function findRemote ( hostname : string ) {
161+ return url
162+ }
163+ const gh = new Github (
164+ {
165+ github : { hostnames : [ "github.mycompany.com" ] } ,
166+ } ,
167+ "origin" ,
168+ findRemote ,
169+ )
170+ const result = await gh . getUrls ( {
171+ selection : {
172+ start : { line : 0 , character : 0 } ,
173+ end : { line : 0 , character : 0 } ,
174+ } ,
175+ head : createBranch ( "master" ) ,
176+ relativeFilePath : "frontend/src/components/App.tsx" ,
177+ } )
178+ const expected = {
179+ blobUrl :
180+ "https://github.mycompany.com/recipeyak/recipeyak/blob/master/frontend/src/components/App.tsx" ,
181+ blameUrl :
182+ "https://github.mycompany.com/recipeyak/recipeyak/blame/master/frontend/src/components/App.tsx" ,
183+ compareUrl :
184+ "https://github.mycompany.com/recipeyak/recipeyak/compare/master" ,
185+ historyUrl :
186+ "https://github.mycompany.com/recipeyak/recipeyak/commits/master/frontend/src/components/App.tsx" ,
187+ prUrl :
188+ "https://github.mycompany.com/recipeyak/recipeyak/pull/new/master" ,
189+ repoUrl : "https://github.mycompany.com/recipeyak/recipeyak" ,
190+ }
191+ assert . deepEqual ( result , expected )
192+ }
193+ } )
153194} )
154195
155196suite ( "Gitlab" , async ( ) => {
0 commit comments