]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/github-url-from-git/Readme.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / github-url-from-git / Readme.md
1
2 # github-url-from-git
3
4 ```js
5 describe('parse(url)', function(){
6   it('should support git://*', function(){
7     var url = 'git://github.com/jamesor/mongoose-versioner';
8     parse(url).should.equal('https://github.com/jamesor/mongoose-versioner');
9   })
10
11   it('should support git://*.git', function(){
12     var url = 'git://github.com/treygriffith/cellar.git';
13     parse(url).should.equal('https://github.com/treygriffith/cellar');
14   })
15
16   it('should support https://*', function(){
17     var url = 'https://github.com/Empeeric/i18n-node';
18     parse(url).should.equal('https://github.com/Empeeric/i18n-node');
19   })
20
21   it('should support https://*.git', function(){
22     var url = 'https://jpillora@github.com/banchee/tranquil.git';
23     parse(url).should.equal('https://github.com/banchee/tranquil');
24   })
25
26   it('should return undefined on failure', function(){
27     var url = 'git://github.com/justgord/.git';
28     assert(null == parse(url));
29   })
30
31   it('should parse git@github.com:bcoe/thumbd.git', function() {
32     var url = 'git@github.com:bcoe/thumbd.git';
33     parse(url).should.eql('https://github.com/bcoe/thumbd');
34   })
35
36   it('should parse git@github.com:bcoe/thumbd.git#2.7.0', function() {
37     var url = 'git@github.com:bcoe/thumbd.git#2.7.0';
38     parse(url).should.eql('https://github.com/bcoe/thumbd');
39   })
40
41   it('should parse git+https://github.com/bcoe/thumbd.git', function() {
42     var url = 'git+https://github.com/bcoe/thumbd.git';
43     parse(url).should.eql('https://github.com/bcoe/thumbd');
44   })
45
46   it('should parse git+ssh://github.com/bcoe/thumbd.git', function() {
47     var url = 'git+ssh://github.com/bcoe/thumbd.git';
48     parse(url).should.eql('https://github.com/bcoe/thumbd');
49   })
50
51   it('should parse https://EastCloud@github.com/EastCloud/node-websockets.git', function() {
52     var url = 'https://EastCloud@github.com/EastCloud/node-websockets.git';
53     parse(url).should.eql('https://github.com/EastCloud/node-websockets');
54   })
55
56   // gist urls.
57
58   it('should parse git@gist urls', function() {
59     var url = 'git@gist.github.com:3135914.git';
60     parse(url).should.equal('https://gist.github.com/3135914')
61   })
62
63   it('should parse https://gist urls', function() {
64     var url = 'https://gist.github.com/3135914.git';
65     parse(url).should.equal('https://gist.github.com/3135914')
66   })
67
68   // Handle arbitrary GitHub Enterprise domains.
69
70   it('should parse parse extra GHE urls provided', function() {
71     var url = 'git://github.example.com/treygriffith/cellar.git';
72     parse(
73       url, {extraBaseUrls: ['github.example.com']}
74     ).should.equal('https://github.example.com/treygriffith/cellar');
75   });
76
77   it('should parse GHE urls with multiple subdomains', function() {
78     var url = 'git://github.internal.example.com/treygriffith/cellar.git';
79     parse(
80       url, {extraBaseUrls: ['github.internal.example.com']}
81     ).should.equal('https://github.internal.example.com/treygriffith/cellar');
82   });
83 })
84
85 describe('re', function() {
86   it('should expose GitHub url parsing regex', function() {
87     parse.re.source.should.equal(
88       /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source
89     )
90   });
91 })
92 ```