@@ -5,16 +5,19 @@ const gitUrlParse = require("..")
55
66// Constants
77const URLS = {
8- ssh :
"[email protected] :42IonicaBizau/git-url-parse" 8+ ssh :
"[email protected] :42IonicaBizau/git-url-parse" 9+ , enterpriseSsh :
"[email protected] :42IonicaBizau/git-url-parse.git'" 910 , https : "https://github.com/42IonicaBizau/git-url-parse"
1011 , ftp : "ftp://github.com/42IonicaBizau/git-url-parse"
1112 , ftps : "ftps://github.com/42IonicaBizau/git-url-parse"
12- , gitSsh : "git+ssh://git @github.com/42IonicaBizau/git-url-parse"
13+ , gitSsh : "git+ssh://custom-user @github.com/42IonicaBizau/git-url-parse"
1314 , ref : "https://github.com/42IonicaBizau/git-url-parse/blob/master/test/index.js"
1415 , shorthand : "42IonicaBizau/git-url-parse"
1516 , commit : "https://github.com/42IonicaBizau/git-url-parse/commit/9c6443245ace92d237b7b274d4606a616e071c4e"
1617} ;
1718
19+ const gitUser = ( url ) => url . replace ( 'custom-user@' , 'git@' ) ;
20+
1821tester . describe ( "parse urls" , test => {
1922
2023 // SSH urls
@@ -45,8 +48,8 @@ tester.describe("parse urls", test => {
4548 test . expect ( res . name ) . toBe ( "git-url-parse" ) ;
4649 test . expect ( res . href ) . toBe ( URLS . ftp ) ;
4750 test . expect ( res . toString ( "https" ) ) . toBe ( URLS . https ) ;
48- test . expect ( res . toString ( "git+ssh" ) ) . toBe ( URLS . gitSsh ) ;
49- test . expect ( res . toString ( "ssh" ) ) . toBe ( URLS . ssh ) ;
51+ test . expect ( res . toString ( "git+ssh" ) ) . toBe ( gitUser ( URLS . gitSsh ) ) ;
52+ test . expect ( res . toString ( "ssh" ) ) . toBe ( gitUser ( URLS . ssh ) ) ;
5053 } ) ;
5154
5255 // FTPS urls
@@ -58,8 +61,8 @@ tester.describe("parse urls", test => {
5861 test . expect ( res . name ) . toBe ( "git-url-parse" ) ;
5962 test . expect ( res . href ) . toBe ( URLS . ftps ) ;
6063 test . expect ( res . toString ( "https" ) ) . toBe ( URLS . https ) ;
61- test . expect ( res . toString ( "git+ssh" ) ) . toBe ( URLS . gitSsh ) ;
62- test . expect ( res . toString ( "ssh" ) ) . toBe ( URLS . ssh ) ;
64+ test . expect ( res . toString ( "git+ssh" ) ) . toBe ( gitUser ( URLS . gitSsh ) ) ;
65+ test . expect ( res . toString ( "ssh" ) ) . toBe ( gitUser ( URLS . ssh ) ) ;
6366 } ) ;
6467
6568 // HTTPS urls
@@ -71,8 +74,8 @@ tester.describe("parse urls", test => {
7174 test . expect ( res . name ) . toBe ( "git-url-parse" ) ;
7275 test . expect ( res . href ) . toBe ( URLS . https ) ;
7376 test . expect ( res . toString ( "https" ) ) . toBe ( URLS . https ) ;
74- test . expect ( res . toString ( "git+ssh" ) ) . toBe ( URLS . gitSsh ) ;
75- test . expect ( res . toString ( "ssh" ) ) . toBe ( URLS . ssh ) ;
77+ test . expect ( res . toString ( "git+ssh" ) ) . toBe ( gitUser ( URLS . gitSsh ) ) ;
78+ test . expect ( res . toString ( "ssh" ) ) . toBe ( gitUser ( URLS . ssh ) ) ;
7679 } ) ;
7780
7881 // HTTPS with ending slash
@@ -83,8 +86,8 @@ tester.describe("parse urls", test => {
8386 test . expect ( res . owner ) . toBe ( "42IonicaBizau" ) ;
8487 test . expect ( res . name ) . toBe ( "git-url-parse" ) ;
8588 test . expect ( res . toString ( "https" ) ) . toBe ( URLS . https ) ;
86- test . expect ( res . toString ( "git+ssh" ) ) . toBe ( URLS . gitSsh ) ;
87- test . expect ( res . toString ( "ssh" ) ) . toBe ( URLS . ssh ) ;
89+ test . expect ( res . toString ( "git+ssh" ) ) . toBe ( gitUser ( URLS . gitSsh ) ) ;
90+ test . expect ( res . toString ( "ssh" ) ) . toBe ( gitUser ( URLS . ssh ) ) ;
8891 } ) ;
8992
9093 // git+ssh protocol
@@ -419,6 +422,7 @@ tester.describe("parse urls", test => {
419422
420423 // shorthand urls
421424 test . should ( "parse shorthand urls" , ( ) => {
425+ console . log ( { shorthand : URLS . shorthand } ) ;
422426 var res = gitUrlParse ( URLS . shorthand ) ;
423427 test . expect ( res . owner ) . toBe ( "42IonicaBizau" ) ;
424428 test . expect ( res . name ) . toBe ( "git-url-parse" ) ;
0 commit comments