@@ -76,22 +76,26 @@ describe('UrlMatch', () => {
7676
7777
7878describe ( 'UrlMatch2' , ( ) => {
79- const url = new UrlMatch < string > ( ) ;
8079 it ( 'http*' , ( ) => {
80+ const url = new UrlMatch < string > ( ) ;
8181 url . add ( 'http*' , 'ok1' ) ;
82- expect ( url . match ( 'http://www.http.com' ) ) . toEqual ( [ 'ok1' ] ) ;
82+ url . add ( '*://*' , 'ok2' ) ;
83+ expect ( url . match ( 'http://www.http.com' ) ) . toEqual ( [ 'ok1' , 'ok2' ] ) ;
84+ expect ( url . match ( 'https://pan.baidu.com/disk/home?from=newversion&stayAtHome=true#/all?path=%2F&vmode=list' ) ) . toEqual ( [ 'ok1' , 'ok2' ] ) ;
8385 } ) ;
8486 it ( 'port' , ( ) => {
87+ const url = new UrlMatch < string > ( ) ;
8588 url . add ( 'http://domain:8080' , 'ok2' ) ;
86- expect ( url . match ( 'http://domain:8080/' ) ) . toEqual ( [ 'ok1' , ' ok2'] ) ;
87- expect ( url . match ( 'http://domain:8080/123' ) ) . toEqual ( [ 'ok1' ] ) ;
89+ expect ( url . match ( 'http://domain:8080/' ) ) . toEqual ( [ 'ok2' ] ) ;
90+ expect ( url . match ( 'http://domain:8080/123' ) ) . toEqual ( [ ] ) ;
8891 } ) ;
8992 it ( '无/' , ( ) => {
93+ const url = new UrlMatch < string > ( ) ;
9094 url . add ( 'http://domain2' , 'ok3' ) ;
9195 url . add ( 'http://domain2*' , 'ok4' ) ;
92- expect ( url . match ( 'http://domain2/' ) ) . toEqual ( [ 'ok1' , ' ok3', 'ok4' ] ) ;
93- expect ( url . match ( 'http://domain2.com/' ) ) . toEqual ( [ 'ok1' , ' ok4'] ) ;
94- expect ( url . match ( 'http://domain2/123' ) ) . toEqual ( [ 'ok1 ' ] ) ;
96+ expect ( url . match ( 'http://domain2/' ) ) . toEqual ( [ 'ok3' , 'ok4' ] ) ;
97+ expect ( url . match ( 'http://domain2.com/' ) ) . toEqual ( [ 'ok4' ] ) ;
98+ expect ( url . match ( 'http://domain2/123' ) ) . toEqual ( [ 'ok4 ' ] ) ;
9599 } )
96100} ) ;
97101
0 commit comments