@@ -52,13 +52,20 @@ describe('theme', () => {
5252 expect ( parse ( { } ) . data ?. capabilities ?. network_access ) . toBeUndefined ( )
5353 } )
5454
55- test ( 'ignores a boolean network_access, as before' , ( ) => {
56- const result = parse ( { network_access : true } )
55+ test . each ( [ true , false ] ) ( 'ignores a boolean network_access of %s , as before' , ( networkAccess ) => {
56+ const result = parse ( { network_access : networkAccess } )
5757
5858 expect ( result . state ) . toBe ( 'ok' )
5959 expect ( result . data ?. capabilities ?. network_access ) . toBeUndefined ( )
6060 } )
6161
62+ test ( 'ignores capabilities that do not apply to theme extensions' , ( ) => {
63+ const result = parse ( { network_access : { allowed_sources : [ ] } , api_access : true , block_progress : true } )
64+
65+ expect ( result . state ) . toBe ( 'ok' )
66+ expect ( result . data ?. capabilities ) . toEqual ( { network_access : { allowed_sources : [ ] } } )
67+ } )
68+
6269 test ( 'requires allowed_sources when the network_access table is declared' , ( ) => {
6370 const result = parse ( { network_access : { } } )
6471
@@ -99,6 +106,13 @@ describe('theme', () => {
99106 [ 'a wildcard that is not the leading label' , 'https://api.*.example.com' ] ,
100107 [ 'a single-label host' , 'https://localhost' ] ,
101108 [ 'an IP address' , 'https://127.0.0.1' ] ,
109+ [ 'an IP address with a hexadecimal final label' , 'https://127.0.0x1' ] ,
110+ [ 'an IP address in hexadecimal notation' , 'https://0x7f.0x1' ] ,
111+ [ 'a link-local IP address in hexadecimal notation' , 'https://0xa9.0xfe.0xa9.0xfe' ] ,
112+ [ 'a wildcard on an IP address' , 'https://*.127.0.0.1' ] ,
113+ [ 'a wildcard on an IP address in hexadecimal notation' , 'https://*.0x7f.0x1' ] ,
114+ [ 'a host that cannot be parsed as a URL' , 'https://example.0xabc' ] ,
115+ [ 'a wildcard on a host that cannot be parsed as a URL' , 'https://*.example.0xabc' ] ,
102116 [ 'an invalid label' , 'https://-api.example.com' ] ,
103117 [ 'an empty label' , 'https://api..example.com' ] ,
104118 [ 'a trailing dot' , 'https://api.example.com./' ] ,
0 commit comments