Skip to content

Commit d6becf8

Browse files
committed
refactor
1 parent 124d500 commit d6becf8

1 file changed

Lines changed: 20 additions & 39 deletions

File tree

src/test/suite/providers.test.ts

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -151,45 +151,26 @@ suite("Github", async () => {
151151
}
152152
})
153153
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-
}
154+
const gh = new Github(
155+
{
156+
github: { hostnames: ["github.mycompany.com"] },
157+
},
158+
"origin",
159+
async () => "git@github.mycompany.com:recipeyak/recipeyak.git",
160+
)
161+
const result = await gh.getUrls({
162+
selection: {
163+
start: { line: 0, character: 0 },
164+
end: { line: 0, character: 0 },
165+
},
166+
head: createBranch("master"),
167+
relativeFilePath: "frontend/src/components/App.tsx",
168+
})
169+
170+
assert.deepEqual(
171+
result?.blameUrl,
172+
"https://github.mycompany.com/recipeyak/recipeyak/blob/master/frontend/src/components/App.tsx",
173+
)
193174
})
194175
})
195176

0 commit comments

Comments
 (0)