@@ -139,113 +139,6 @@ describe('hyperlink', function() {
139139 } ) ;
140140 } ) ;
141141
142- it ( 'should complain if an asset loaded has an unexpected Content-Type' , async function ( ) {
143- httpception ( [
144- {
145- request : 'GET https://example.com/' ,
146- response : {
147- statusCode : 200 ,
148- headers : {
149- 'Content-Type' : 'text/html; charset=UTF-8'
150- } ,
151- body : `
152- <!DOCTYPE html>
153- <html>
154- <head>
155- <link rel="stylesheet" href="styles.css">
156- </head>
157- <body>
158- </body>
159- </html>
160- `
161- }
162- } ,
163- {
164- request : 'GET https://example.com/styles.css' ,
165- response : {
166- headers : {
167- 'Content-Type' : 'image/png'
168- } ,
169- body : 'div { color: maroon; }'
170- }
171- }
172- ] ) ;
173-
174- const t = new TapRender ( ) ;
175- sinon . spy ( t , 'push' ) ;
176- await hyperlink (
177- {
178- root : 'https://example.com/' ,
179- inputUrls : [ 'https://example.com/' ]
180- } ,
181- t
182- ) ;
183-
184- expect ( t . close ( ) , 'to satisfy' , { fail : 1 } ) ;
185- expect ( t . push , 'to have a call satisfying' , ( ) => {
186- t . push ( null , {
187- ok : false ,
188- operator : 'content-type-mismatch' ,
189- name : 'content-type-mismatch https://example.com/styles.css' ,
190- actual : 'Asset is used as both Css and Png' ,
191- at :
192- 'https://example.com/ (5:44) <link rel="stylesheet" href="styles.css">'
193- } ) ;
194- } ) ;
195- } ) ;
196-
197- it ( 'should complain if an asset being HEADed has an unexpected Content-Type' , async function ( ) {
198- httpception ( [
199- {
200- request : 'GET https://example.com/' ,
201- response : {
202- statusCode : 200 ,
203- headers : {
204- 'Content-Type' : 'text/html; charset=UTF-8'
205- } ,
206- body : `
207- <!DOCTYPE html>
208- <html>
209- <head></head>
210- <body>
211- <img src="hey.png">
212- </body>
213- </html>
214- `
215- }
216- } ,
217- {
218- request : 'HEAD https://example.com/hey.png' ,
219- response : {
220- headers : {
221- 'Content-Type' : 'text/plain'
222- }
223- }
224- }
225- ] ) ;
226-
227- const t = new TapRender ( ) ;
228- sinon . spy ( t , 'push' ) ;
229- await hyperlink (
230- {
231- root : 'https://example.com/' ,
232- inputUrls : [ 'https://example.com/' ]
233- } ,
234- t
235- ) ;
236-
237- expect ( t . close ( ) , 'to satisfy' , { fail : 1 } ) ;
238- expect ( t . push , 'to have a call satisfying' , ( ) => {
239- t . push ( null , {
240- ok : false ,
241- operator : 'content-type-mismatch' ,
242- name : 'content-type-mismatch https://example.com/hey.png' ,
243- actual : 'Asset is used as both Image and Text' ,
244- at : 'https://example.com/ (6:25) <img src="hey.png">'
245- } ) ;
246- } ) ;
247- } ) ;
248-
249142 it ( 'should complain if an asset being HEADed has no Content-Type' , async function ( ) {
250143 httpception ( [
251144 {
0 commit comments