@@ -17,8 +17,8 @@ describe('middleware.karma', () => {
1717 let response
1818
1919 class MockFile extends File {
20- constructor ( path , sha , type , content ) {
21- super ( path , undefined , undefined , type )
20+ constructor ( path , sha , type , content , integrity ) {
21+ super ( path , undefined , undefined , type , undefined , integrity )
2222 this . sha = sha || 'sha-default'
2323 this . content = content
2424 }
@@ -230,6 +230,21 @@ describe('middleware.karma', () => {
230230 callHandlerWith ( '/__karma__/context.html' )
231231 } )
232232
233+ it ( 'should serve context.html with script tags with integrity checking' , ( done ) => {
234+ includedFiles ( [
235+ new MockFile ( '/first.js' , 'sha123' ) ,
236+ new MockFile ( '/second.js' , 'sha456' , undefined , undefined , 'sha256-XXX' )
237+ ] )
238+
239+ response . once ( 'end' , ( ) => {
240+ expect ( nextSpy ) . not . to . have . been . called
241+ expect ( response ) . to . beServedAs ( 200 , 'CONTEXT\n<script type="text/javascript" src="/__proxy__/__karma__/absolute/first.js?sha123" crossorigin="anonymous"></script>\n<script type="text/javascript" src="/__proxy__/__karma__/absolute/second.js?sha456" integrity="sha256-XXX" crossorigin="anonymous"></script>' )
242+ done ( )
243+ } )
244+
245+ callHandlerWith ( '/__karma__/context.html' )
246+ } )
247+
233248 it ( 'should serve context.html with replaced link tags' , ( done ) => {
234249 includedFiles ( [
235250 new MockFile ( '/first.css' , 'sha007' ) ,
0 commit comments