1- var should = require ( "should" ) ;
2- var sinon = require ( "sinon" ) ;
3- var ConcatSource = require ( "webpack-sources" ) . ConcatSource ;
4- var WebWorkerHotUpdateChunkTemplatePlugin = require ( "../lib/webworker/WebWorkerHotUpdateChunkTemplatePlugin" ) ;
5- var applyPluginWithOptions = require ( "./helpers/applyPluginWithOptions" ) ;
1+ "use strict" ;
62
7- describe ( "WebWorkerHotUpdateChunkTemplatePlugin" , function ( ) {
8- var handlerContext ;
3+ const should = require ( "should" ) ;
4+ const sinon = require ( "sinon" ) ;
5+ const ConcatSource = require ( "webpack-sources" ) . ConcatSource ;
6+ const WebWorkerHotUpdateChunkTemplatePlugin = require ( "../lib/webworker/WebWorkerHotUpdateChunkTemplatePlugin" ) ;
7+ const applyPluginWithOptions = require ( "./helpers/applyPluginWithOptions" ) ;
98
10- beforeEach ( function ( ) {
9+ describe ( "WebWorkerHotUpdateChunkTemplatePlugin" , ( ) => {
10+ let handlerContext ;
11+
12+ beforeEach ( ( ) => {
1113 handlerContext = {
1214 outputOptions : {
1315 hotUpdateFunction : "Foo" ,
@@ -16,63 +18,53 @@ describe("WebWorkerHotUpdateChunkTemplatePlugin", function() {
1618 } ;
1719 } ) ;
1820
19- it ( "has apply function" , function ( ) {
20- ( new WebWorkerHotUpdateChunkTemplatePlugin ( ) ) . apply . should . be . a . Function ( ) ;
21- } ) ;
21+ it ( "has apply function" , ( ) => ( new WebWorkerHotUpdateChunkTemplatePlugin ( ) ) . apply . should . be . a . Function ( ) ) ;
2222
23- describe ( "when applied" , function ( ) {
24- var eventBindings , eventBinding ;
23+ describe ( "when applied" , ( ) => {
24+ let eventBindings , eventBinding ;
2525
26- beforeEach ( function ( ) {
27- eventBindings = applyPluginWithOptions ( WebWorkerHotUpdateChunkTemplatePlugin ) ;
28- } ) ;
26+ beforeEach ( ( ) => eventBindings = applyPluginWithOptions ( WebWorkerHotUpdateChunkTemplatePlugin ) ) ;
2927
30- it ( "binds two event handlers" , function ( ) {
31- eventBindings . length . should . be . exactly ( 2 ) ;
32- } ) ;
28+ it ( "binds two event handlers" , ( ) => eventBindings . length . should . be . exactly ( 2 ) ) ;
3329
34- describe ( "render handler" , function ( ) {
35- beforeEach ( function ( ) {
36- eventBinding = eventBindings [ 0 ] ;
37- } ) ;
30+ describe ( "render handler" , ( ) => {
31+ beforeEach ( ( ) => eventBinding = eventBindings [ 0 ] ) ;
3832
39- it ( "binds to render event" , function ( ) {
40- eventBinding . name . should . be . exactly ( "render" ) ;
41- } ) ;
33+ it ( "binds to render event" , ( ) => eventBinding . name . should . be . exactly ( "render" ) ) ;
4234
43- describe ( "with hot update function name set" , function ( ) {
44- it ( "creates source wrapper with function name" , function ( ) {
45- var source = eventBinding . handler . call ( handlerContext , "moduleSource()" , [ ] , [ ] , { } , 100 ) ;
35+ describe ( "with hot update function name set" , ( ) => {
36+ it ( "creates source wrapper with function name" , ( ) => {
37+ const source = eventBinding . handler . call ( handlerContext , "moduleSource()" , [ ] , [ ] , { } , 100 ) ;
4638 source . should . be . instanceof ( ConcatSource ) ;
4739 source . source ( ) . should . be . exactly ( "Foo(100,moduleSource())" ) ;
4840 } ) ;
4941 } ) ;
5042
51- describe ( "without hot update function name set" , function ( ) {
52- it ( "creates source wrapper with library name" , function ( ) {
43+ describe ( "without hot update function name set" , ( ) => {
44+ it ( "creates source wrapper with library name" , ( ) => {
5345 delete handlerContext . outputOptions . hotUpdateFunction ;
54- var source = eventBinding . handler . call ( handlerContext , "moduleSource()" , [ ] , [ ] , { } , 100 ) ;
46+ const source = eventBinding . handler . call ( handlerContext , "moduleSource()" , [ ] , [ ] , { } , 100 ) ;
5547 source . should . be . instanceof ( ConcatSource ) ;
5648 source . source ( ) . should . be . exactly ( "webpackHotUpdateBar(100,moduleSource())" ) ;
5749 } ) ;
5850 } ) ;
5951 } ) ;
6052
61- describe ( "hash handler" , function ( ) {
62- var hashMock ;
53+ describe ( "hash handler" , ( ) => {
54+ let hashMock ;
6355
64- beforeEach ( function ( ) {
56+ beforeEach ( ( ) => {
6557 eventBinding = eventBindings [ 1 ] ;
6658 hashMock = {
6759 update : sinon . spy ( )
6860 } ;
6961 } ) ;
7062
71- it ( "binds to hash event" , function ( ) {
63+ it ( "binds to hash event" , ( ) => {
7264 eventBinding . name . should . be . exactly ( "hash" ) ;
7365 } ) ;
7466
75- it ( "updates hash object" , function ( ) {
67+ it ( "updates hash object" , ( ) => {
7668 eventBinding . handler . call ( handlerContext , hashMock ) ;
7769 hashMock . update . callCount . should . be . exactly ( 4 ) ;
7870 sinon . assert . calledWith ( hashMock . update , "WebWorkerHotUpdateChunkTemplatePlugin" ) ;
0 commit comments