@@ -10,6 +10,7 @@ const URLS = {
10
10
, ftp : "ftp://github.com/IonicaBizau/git-url-parse"
11
11
, ftps : "ftps://github.com/IonicaBizau/git-url-parse"
12
12
, gitSsh :
"git+ssh://[email protected] /IonicaBizau/git-url-parse.git"
13
+ , ref : "https://github.com/IonicaBizau/git-url-parse/blob/master/test/index.js"
13
14
} ;
14
15
15
16
tester . describe ( "parse urls" , test => {
@@ -124,6 +125,19 @@ tester.describe("parse urls", test => {
124
125
test . expect ( res . name ) . toBe ( "name" ) ;
125
126
} ) ;
126
127
128
+ // ref and filepath urls
129
+ test . should ( "parse ref/filepath urls" , ( ) => {
130
+ var res = gitUrlParse ( URLS . ref ) ;
131
+ test . expect ( res . protocol ) . toBe ( "https" ) ;
132
+ test . expect ( res . source ) . toBe ( "github.com" ) ;
133
+ test . expect ( res . owner ) . toBe ( "IonicaBizau" ) ;
134
+ test . expect ( res . name ) . toBe ( "git-url-parse" ) ;
135
+ test . expect ( res . href ) . toBe ( URLS . ref ) ;
136
+ test . expect ( res . ref ) . toBe ( "master" ) ;
137
+ test . expect ( res . filepathtype ) . toBe ( "blob" ) ;
138
+ test . expect ( res . filepath ) . toBe ( "test/index.js" ) ;
139
+ } ) ;
140
+
127
141
test . should ( "parse subdomains" , ( ) => {
128
142
var res = gitUrlParse ( "https://gist.github.com/owner/id" ) ;
129
143
test . expect ( res . source ) . toBe ( "github.com" ) ;
0 commit comments