File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ // This intentionally does not use resources/urltestdata.json to preserve resources.
2
+ [
3
+ {
4
+ "url" : undefined ,
5
+ "base" : undefined ,
6
+ "expected" : false
7
+ } ,
8
+ {
9
+ "url" : "aaa:b" ,
10
+ "base" : undefined ,
11
+ "expected" : true
12
+ } ,
13
+ {
14
+ "url" : undefined ,
15
+ "base" : "aaa:b" ,
16
+ "expected" : false
17
+ } ,
18
+ {
19
+ "url" : "aaa:/b" ,
20
+ "base" : undefined ,
21
+ "expected" : true
22
+ } ,
23
+ {
24
+ "url" : undefined ,
25
+ "base" : "aaa:/b" ,
26
+ "expected" : true
27
+ } ,
28
+ {
29
+ "url" : "https://test:test" ,
30
+ "base" : undefined ,
31
+ "expected" : false
32
+ } ,
33
+ {
34
+ "url" : "a" ,
35
+ "base" : "https://b/" ,
36
+ "expected" : true
37
+ }
38
+ ] . forEach ( ( { url, base, expected } ) => {
39
+ test ( ( ) => {
40
+ if ( expected == false ) {
41
+ assert_equals ( URL . parse ( url , base ) , null ) ;
42
+ } else {
43
+ assert_equals ( URL . parse ( url , base ) . href = new URL ( url , base ) . href ) ;
44
+ }
45
+ } , `URL.parse(${ url } , ${ base } )` ) ;
46
+ } ) ;
47
+
48
+ test ( ( ) => {
49
+ assert_not_equals ( URL . parse ( "https://example/" ) , URL . parse ( "https://example/" ) ) ;
50
+ } , `URL.parse() should return a unique object` ) ;
You can’t perform that action at this time.
0 commit comments