@@ -49,7 +49,6 @@ test('sanitize()', async function (t) {
4949 await t . test ( 'should ignore unknown nodes' , async function ( ) {
5050 assert . equal (
5151 toHtml (
52- // @ts -expect-error: remove when `hast-util-to-html` updates.
5352 sanitize (
5453 // @ts -expect-error: check how an unknown node is
5554 u ( 'unknown' , '<xml></xml>' )
@@ -62,23 +61,14 @@ test('sanitize()', async function (t) {
6261
6362test ( '`comment`' , async function ( t ) {
6463 await t . test ( 'should ignore `comment`s by default' , async function ( ) {
65- assert . equal (
66- toHtml (
67- // @ts -expect-error: remove when `hast-util-to-html` updates.
68- sanitize ( u ( 'comment' , 'alpha' ) )
69- ) ,
70- ''
71- )
64+ assert . equal ( toHtml ( sanitize ( u ( 'comment' , 'alpha' ) ) ) , '' )
7265 } )
7366
7467 await t . test (
7568 'should allow `comment`s with `allowComments: true`' ,
7669 async function ( ) {
7770 assert . equal (
78- toHtml (
79- // @ts -expect-error: remove when `hast-util-to-html` updates.
80- sanitize ( u ( 'comment' , 'alpha' ) , { allowComments : true } )
81- ) ,
71+ toHtml ( sanitize ( u ( 'comment' , 'alpha' ) , { allowComments : true } ) ) ,
8272 '<!--alpha-->'
8373 )
8474 }
@@ -102,7 +92,6 @@ test('`comment`', async function (t) {
10292 async function ( ) {
10393 assert . equal (
10494 toHtml (
105- // @ts -expect-error: remove when `hast-util-to-html` updates.
10695 sanitize ( u ( 'comment' , 'alpha--><script>alert(1)</script><!--bravo' ) , {
10796 allowComments : true
10897 } )
@@ -115,19 +104,14 @@ test('`comment`', async function (t) {
115104
116105test ( '`doctype`' , async function ( t ) {
117106 await t . test ( 'should ignore `doctype`s by default' , async function ( ) {
118- assert . equal (
119- // @ts -expect-error: remove when `hast-util-to-html` updates.
120- toHtml ( sanitize ( u ( 'doctype' , { name : 'html' } , 'alpha' ) ) ) ,
121- ''
122- )
107+ assert . equal ( toHtml ( sanitize ( u ( 'doctype' , { name : 'html' } , 'alpha' ) ) ) , '' )
123108 } )
124109
125110 await t . test (
126111 'should allow `doctype`s with `allowDoctypes: true`' ,
127112 async function ( ) {
128113 assert . equal (
129114 toHtml (
130- // @ts -expect-error: remove when `hast-util-to-html` updates.
131115 sanitize ( u ( 'doctype' , { name : 'html' } , 'alpha' ) , {
132116 allowDoctypes : true
133117 } )
@@ -168,11 +152,7 @@ test('`text`', async function (t) {
168152 } )
169153
170154 await t . test ( 'should allow `text`' , async function ( ) {
171- assert . equal (
172- // @ts -expect-error: remove when `hast-util-to-html` updates.
173- toHtml ( sanitize ( u ( 'text' , 'alert(1)' ) ) ) ,
174- 'alert(1)'
175- )
155+ assert . equal ( toHtml ( sanitize ( u ( 'text' , 'alert(1)' ) ) ) , 'alert(1)' )
176156 } )
177157
178158 await t . test ( 'should ignore non-string `value`s' , async function ( ) {
@@ -184,21 +164,12 @@ test('`text`', async function (t) {
184164 } )
185165
186166 await t . test ( 'should ignore `text` in `script` elements' , async function ( ) {
187- assert . equal (
188- toHtml (
189- // @ts -expect-error: remove when `hast-util-to-html` updates.
190- sanitize ( h ( 'script' , u ( 'text' , 'alert(1)' ) ) )
191- ) ,
192- ''
193- )
167+ assert . equal ( toHtml ( sanitize ( h ( 'script' , u ( 'text' , 'alert(1)' ) ) ) ) , '' )
194168 } )
195169
196170 await t . test ( 'should show `text` in `style` elements' , async function ( ) {
197171 assert . equal (
198- toHtml (
199- // @ts -expect-error: remove when `hast-util-to-html` updates.
200- sanitize ( h ( 'style' , u ( 'text' , 'alert(1)' ) ) )
201- ) ,
172+ toHtml ( sanitize ( h ( 'style' , u ( 'text' , 'alert(1)' ) ) ) ) ,
202173 'alert(1)'
203174 )
204175 } )
0 commit comments