@@ -82,6 +82,12 @@ describe("UrlMatch-search", () => {
8282 expect ( url . match ( "https://www.example.com/path/foo/bar/baz" ) ) . toEqual ( [ "ok1" ] ) ;
8383 expect ( url . match ( "https://www.example.com/path2/foo" ) ) . toEqual ( [ ] ) ;
8484 } ) ;
85+ it ( "http*" , ( ) => {
86+ const url = new UrlMatch < string > ( ) ;
87+ url . add ( "http*" , "ok1" ) ;
88+ expect ( url . match ( "http://www.example.com" ) ) . toEqual ( [ "ok1" ] ) ;
89+ expect ( url . match ( "https://www.example.com" ) ) . toEqual ( [ "ok1" ] ) ;
90+ } ) ;
8591} ) ;
8692
8793describe ( "UrlMatch-port1" , ( ) => {
@@ -141,20 +147,23 @@ describe("dealPatternMatches", () => {
141147 "*://api.*.*.example.com/*" ,
142148 "*://*example.com/*" ,
143149 "*.example.com/path/*" ,
150+ "http*" ,
144151 ] ) ;
145152 expect ( matches . patternResult ) . toEqual ( [
146153 "*://*/*" ,
147154 "*://*.example.com/*" ,
148155 "*://*.example.com/*" ,
149156 "*://example.com/*" ,
150157 "*://*.example.com/path/*" ,
158+ "*://*/*" ,
151159 ] ) ;
152160 expect ( matches . result ) . toEqual ( [
153161 "*://www.example.com*" ,
154162 "*://api.*.example.com/*" ,
155163 "*://api.*.*.example.com/*" ,
156164 "*://*example.com/*" ,
157165 "*.example.com/path/*" ,
166+ "http*" ,
158167 ] ) ;
159168 } ) ;
160169 it ( "特殊情况-exclude" , ( ) => {
@@ -246,11 +255,16 @@ describe("parsePatternMatchesURL", () => {
246255 path : "*" ,
247256 } ) ;
248257 matches = parsePatternMatchesURL ( "*.example.com/path/*" ) ;
249- console . log ( matches ) ;
250258 expect ( matches ) . toEqual ( {
251259 scheme : "*" ,
252260 host : "*.example.com" ,
253261 path : "path/*" ,
254262 } ) ;
263+ matches = parsePatternMatchesURL ( "http*" ) ;
264+ expect ( matches ) . toEqual ( {
265+ scheme : "*" ,
266+ host : "*" ,
267+ path : "*" ,
268+ } ) ;
255269 } ) ;
256270} ) ;
0 commit comments