-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
URL structures of gitlab.com seem to be same as github.com
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,48 @@ suite('gitProvider', function () { | |
}); | ||
}); | ||
|
||
suite('GitLab', function () { | ||
const remoteUrl = `https://gitlab.com/${userName}/${repoName}.git`; | ||
const provider = gitProvider(remoteUrl); | ||
|
||
suite('#webUrl(branch, filePath)', function () { | ||
test('should returns file URL', function () { | ||
const expectedUrl = `https://gitlab.com/${userName}/${repoName}/blob/${branch}${filePath}`; | ||
const webUrl = provider.webUrl(branch, filePath); | ||
expect(webUrl).to.equal(expectedUrl); | ||
}); | ||
}); | ||
|
||
suite('#webUrl(branch, filePath, line)', function () { | ||
test('should returns file URL with line hash', function () { | ||
const expectedUrl = `https://gitlab.com/${userName}/${repoName}/blob/${branch}${filePath}#L${line}`; | ||
const webUrl = provider.webUrl(branch, filePath, line); | ||
expect(webUrl).to.equal(expectedUrl); | ||
}); | ||
}); | ||
|
||
suite('#webUrl(branch)', function () { | ||
test('should returns repository root URL', function () { | ||
const expectedUrl = `https://gitlab.com/${userName}/${repoName}/tree/${branch}`; | ||
const webUrl = provider.webUrl(branch); | ||
expect(webUrl).to.equal(expectedUrl); | ||
}); | ||
}); | ||
|
||
suite('with ssh remote URL', function () { | ||
const remoteUrl = `[email protected]:${userName}/${repoName}.git`; | ||
const provider = gitProvider(remoteUrl); | ||
|
||
suite('#webUrl(branch, filePath)', function () { | ||
test('should returns HTTPS URL', function () { | ||
const expectedUrl = `https://gitlab.com/${userName}/${repoName}/blob/${branch}${filePath}`; | ||
const webUrl = provider.webUrl(branch, filePath); | ||
expect(webUrl).to.equal(expectedUrl); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
suite('VisualStudio', function () { | ||
const projectName = 'testProject'; | ||
const remoteUrl = `https://test-account.visualstudio.com/${projectName}/_git/${repoName}.git`; | ||
|