@@ -49,8 +49,16 @@ const printable =
4949 '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
5050const punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
5151const sixDigitsCodeTest = '123456'
52- const url1 = 'http://console.scaleway.com'
53- const url2 = 'https://www.scaleway.com'
52+ const urls = [
53+ 'http://console.scaleway.com' ,
54+ 'https://www.scaleway.com' ,
55+ 'https://www.scaleway.online' ,
56+ 'http://www.scaleway.com:8080' ,
57+ 'http://255.255.255.255' ,
58+ 'http://www.example.com/product' ,
59+ 'http://www.example.com/products?id=1&page=2' ,
60+ 'http://www.example.com#up' ,
61+ ]
5462const whitespace = ' \t\n\r\x0b\x0c'
5563const macAddress1 = '1F:B5:FA:47:CD:C4'
5664const linuxPaths = {
@@ -420,8 +428,7 @@ describe('@regex', () => {
420428 [ whitespace , false ] ,
421429 [ cronTest , false ] ,
422430 [ macAddress1 , false ] ,
423- [ url1 , false ] ,
424- [ url2 , false ] ,
431+ ...( urls . map ( urlString => [ urlString , false ] ) as [ string , boolean ] [ ] ) ,
425432 ] ) ( 'should match regex %s to be %s' , ( string , expected ) => {
426433 expect ( basicDomain . test ( string ) ) . toBe ( expected )
427434 } )
@@ -604,8 +611,9 @@ describe('@regex', () => {
604611 [ whitespace , false ] ,
605612 [ cronTest , false ] ,
606613 [ macAddress1 , false ] ,
607- [ url1 , true ] ,
608- [ url2 , true ] ,
614+ [ domain , false ] ,
615+ [ subDomain , false ] ,
616+ ...( urls . map ( urlString => [ urlString , true ] ) as [ string , boolean ] [ ] ) ,
609617 ] ) ( 'should match regex %s to be %s' , ( string , expected ) => {
610618 expect ( url . test ( string ) ) . toBe ( expected )
611619 } )
0 commit comments