-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for source links on GitHub enterprise instances (#843)
* Add support for source links on GitHub enterprise instances * Export Repository class from GitHub plugin Needed for better unit testing * Let Repository class constructor take urls as parameter Allows us to more easily unit test the class by passing in an array of strings * Add unit tests for GitHubRepository class
- Loading branch information
1 parent
c03ac2d
commit 02d2882
Showing
2 changed files
with
54 additions
and
18 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as github from './../lib/converter/plugins/GitHubPlugin'; | ||
import Assert = require('assert'); | ||
|
||
describe('GitHubRepository', function() { | ||
|
||
describe('contructor', function() { | ||
it('must default to github.com hostname', function() { | ||
let repository = new github.Repository('', '', []); | ||
|
||
Assert.equal(repository.gitHubHostname, 'github.com'); | ||
}); | ||
|
||
it('must correctly handle an enterprise github URL hostname', function() { | ||
let mockRemotes = [ | ||
'[email protected]:joebloggs/foobar.git' | ||
]; | ||
|
||
let repository = new github.Repository('', '', mockRemotes); | ||
|
||
Assert.equal(repository.gitHubHostname, 'github.acme.com'); | ||
}); | ||
}); | ||
}); |