@@ -37,6 +37,13 @@ describe('Server islands', () => {
37
37
assert . equal ( serverIslandEl . length , 0 ) ;
38
38
} ) ;
39
39
40
+ it ( 'HTML escapes scripts' , async ( ) => {
41
+ const res = await fixture . fetch ( '/' ) ;
42
+ assert . equal ( res . status , 200 ) ;
43
+ const html = await res . text ( ) ;
44
+ assert . equal ( html . includes ( "</script><script>alert('xss')</script><!--" ) , false ) ;
45
+ } ) ;
46
+
40
47
it ( 'island is not indexed' , async ( ) => {
41
48
const res = await fixture . fetch ( '/_server-islands/Island' , {
42
49
method : 'POST' ,
@@ -62,7 +69,7 @@ describe('Server islands', () => {
62
69
assert . equal ( works , 'true' , 'able to set header from server island' ) ;
63
70
} ) ;
64
71
it ( 'omits empty props from the query string' , async ( ) => {
65
- const res = await fixture . fetch ( '/' ) ;
72
+ const res = await fixture . fetch ( '/empty-props ' ) ;
66
73
assert . equal ( res . status , 200 ) ;
67
74
const html = await res . text ( ) ;
68
75
const fetchMatch = html . match ( / f e t c h \( ' \/ _ s e r v e r - i s l a n d s \/ I s l a n d \? [ ^ ' ] * p = ( [ ^ & ' ] * ) / ) ;
@@ -135,7 +142,7 @@ describe('Server islands', () => {
135
142
} ) ;
136
143
it ( 'omits empty props from the query string' , async ( ) => {
137
144
const app = await fixture . loadTestAdapterApp ( ) ;
138
- const request = new Request ( 'http://example.com/' ) ;
145
+ const request = new Request ( 'http://example.com/empty-props ' ) ;
139
146
const response = await app . render ( request ) ;
140
147
assert . equal ( response . status , 200 ) ;
141
148
const html = await response . text ( ) ;
0 commit comments