-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update creation of tag link in default success template (#90)
fixes: #82
- Loading branch information
Showing
4 changed files
with
24 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
.idea/ |
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
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 |
---|---|---|
@@ -1,53 +1,60 @@ | ||
const assert = require('assert') | ||
const getRepoInfo = require('../lib/getRepoInfo') | ||
|
||
const runAssert = (repoUrl, path, url) => { | ||
const runAssert = (repoUrl, path, url, hostname) => { | ||
const actual = getRepoInfo(repoUrl) | ||
|
||
assert.equal(path, actual.path) | ||
assert.equal(url, actual.URL) | ||
assert.equal(hostname, actual.hostname) | ||
} | ||
|
||
describe('test getRepoInfo', () => { | ||
it('should work for github', () => { | ||
const repositoryUrl = 'ssh://[email protected]:hello/world.git' | ||
const expectedPath = 'hello/world' | ||
const expectedUrl = 'https://github.com/hello/world' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl) | ||
const expectedHostname = 'github.com' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl, expectedHostname) | ||
}) | ||
|
||
it('should work for bitbucket', () => { | ||
const repositoryUrl = 'ssh://[email protected]/hello/world.git' | ||
const expectedPath = 'hello/world' | ||
const expectedUrl = 'https://bitbucket.org/hello/world' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl) | ||
const expectedHostname = 'bitbucket.org' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl, expectedHostname) | ||
}) | ||
|
||
it('should work for gitlab', () => { | ||
const repositoryUrl = 'ssh://[email protected]:hello/world.git' | ||
const expectedPath = 'hello/world' | ||
const expectedUrl = 'https://gitlab.com/hello/world' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl) | ||
const expectedHostname = 'gitlab.com' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl, expectedHostname) | ||
}) | ||
|
||
it('should work for repo url with https', () => { | ||
const repositoryUrl = 'https://github.com/hello/world.git' | ||
const expectedPath = 'hello/world' | ||
const expectedUrl = 'https://github.com/hello/world' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl) | ||
const expectedHostname = 'github.com' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl, expectedHostname) | ||
}) | ||
|
||
it('should work for repo url with git@', () => { | ||
const repositoryUrl = '[email protected]:hello/world.git' | ||
const expectedPath = 'hello/world' | ||
const expectedUrl = 'https://github.com/hello/world' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl) | ||
const expectedHostname = 'github.com' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl, expectedHostname) | ||
}) | ||
|
||
it('should work for repo url with other TLD', () => { | ||
const repositoryUrl = '[email protected]:hello/world.git' | ||
const expectedPath = 'hello/world' | ||
const expectedUrl = 'https://github.pl/hello/world' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl) | ||
const expectedHostname = 'github.pl' | ||
runAssert(repositoryUrl, expectedPath, expectedUrl, expectedHostname) | ||
}) | ||
}) |