@@ -16,28 +16,37 @@ describe("isUrlRequest()", () => {
16
16
[ [ "//google.com" ] , false , "should be negative for scheme-agnostic urls" ] ,
17
17
[ [ "http://google.com" ] , false , "should be negative for http urls" ] ,
18
18
[ [ "https://google.com" ] , false , "should be negative for https urls" ] ,
19
- [ [ "chrome-extension://" ] , false , "should be negative for https urls" ] ,
20
- [ [ "moz-extension://" ] , false , "should be negative for https urls" ] ,
21
- [ [ "ms-browser-extension://" ] , false , "should be negative for https urls" ] ,
19
+
20
+ [ [ "chrome-extension://" ] , false , "should be negative for nonstandard urls" ] ,
21
+ [ [ "moz-extension://" ] , false , "should be negative for nonstandard urls" ] ,
22
+ [ [ "ms-browser-extension://" ] , false , "should be negative for nonstandard urls" ] ,
23
+ [ [ "custom-extension://" ] , false , "should be negative for nonstandard urls" ] ,
24
+
22
25
[ [ "path/to/thing" ] , true , "should be positive for implicit relative urls" ] ,
23
26
[ [ "./path/to/thing" ] , true , "should be positive for explicit relative urls" ] ,
24
27
[ [ "~path/to/thing" ] , true , "should be positive for module urls (with ~)" ] ,
25
28
[ [ "some/other/stuff/and/then~path/to/thing" ] , true , "should be positive for module urls with path prefix" ] ,
26
29
[ [ "./some/other/stuff/and/then~path/to/thing" ] , true , "should be positive for module urls with relative path prefix" ] ,
30
+
27
31
// with root (normal path)
28
32
[ [ "path/to/thing" , "root/dir" ] , true , "should be positive with root if implicit relative url" ] ,
29
33
[ [ "./path/to/thing" , "root/dir" ] , true , "should be positive with root if explicit relative url" ] ,
30
34
[ [ "/path/to/thing" , "root/dir" ] , true , "should be positive with root if root-relative url" ] ,
35
+
31
36
// with root (boolean)
32
37
[ [ "/path/to/thing" , true ] , true , "should be positive for root-relative if root = `true`" ] ,
38
+
33
39
// with root (boolean) on Windows
34
40
[ [ "C:\\path\\to\\thing" ] , true , "should be positive for Windows absolute paths with drive letter" ] ,
35
41
[ [ "\\\\?\\UNC\\ComputerName\\path\\to\\thing" ] , true , "should be positive for Windows absolute UNC paths" ] ,
42
+
36
43
// with root (module)
37
44
[ [ "/path/to/thing" , "~" ] , true , "should be positive for module url if root = ~" ] ,
45
+
38
46
// with root (module path)
39
47
[ [ "/path/to/thing" , "~module" ] , true , "should be positive for module prefixes when root starts with ~" ] ,
40
48
[ [ "/path/to/thing" , "~module/" ] , true , "should be positive for module prefixes (with trailing slash) when root starts with ~" ] ,
49
+
41
50
// error cases
42
51
[ [ "/path/to/thing" , 1 ] , new ExpectedError ( / u n e x p e c t e d p a r a m e t e r s / i) , "should throw an error on invalid root" ] ,
43
52
0 commit comments