describe('index.test.js', function () {
it('should support git://*', function () {
var url = 'git://github.com/jamesor/mongoose-versioner';
parser(url).should.equal('github.com/jamesor/mongoose-versioner');
});
it('should support git://*.git', function () {
var url = 'git://github.com/treygriffith/cellar.git';
parser(url).should.equal('github.com/treygriffith/cellar');
});
it('should support https://*', function () {
var url = 'https://github.com/Empeeric/i18n-node';
parser(url).should.equal('github.com/Empeeric/i18n-node');
});
it('should parse https://*.git', function () {
var url = 'https://jpillora@github.com/banchee/tranquil.git';
parser(url).should.equal('github.com/banchee/tranquil');
});
it('should return undefined on failure', function () {
var url = 'git://github.com/justgord/.git';
assert(parser(url) == null);
});
it('should parse git@gist urls', function () {
var url = 'git@gist.github.com:3135914.git';
parser(url).should.equal('gist.github.com/3135914');
});
it('should parse https://gist urls', function () {
var url = 'https://gist.github.com/3135914.git';
parser(url).should.equal('gist.github.com/3135914');
});
it('should parse git@github urls', function () {
var url = 'git@github.com:AdoHe/ImageServer.git';
parser(url).should.equal('github.com/AdoHe/ImageServer');
});
it('should parse company specific git@* urls', function () {
var url = 'git@dev.sh.westudio.com:framework/Tunnel.git';
parser(url).should.equal('dev.sh.westudio.com/framework/Tunnel');
});
})
describe('re', function () {
it('should get the url parse regex', function () {
parser.re.source.should.equal(
/^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?((?:\w+.?){1,}\w+)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source
)
});
})
-
Notifications
You must be signed in to change notification settings - Fork 1
parse url from git repo, support github.com and also company specific git repo url
License
adohe-zz/node-url-from-git
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
parse url from git repo, support github.com and also company specific git repo url
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published