1- var should = require ( "should" ) ;
2- var sinon = require ( "sinon" ) ;
3- var ConcatSource = require ( "webpack-sources" ) . ConcatSource ;
4- var NodeHotUpdateChunkTemplatePlugin = require ( "../lib/node/NodeHotUpdateChunkTemplatePlugin" ) ;
5- var applyPluginWithOptions = require ( "./helpers/applyPluginWithOptions" ) ;
1+ "use strict" ;
62
7- describe ( "NodeHotUpdateChunkTemplatePlugin" , function ( ) {
8- var handlerContext ;
3+ const should = require ( "should" ) ;
4+ const sinon = require ( "sinon" ) ;
5+ const ConcatSource = require ( "webpack-sources" ) . ConcatSource ;
6+ const NodeHotUpdateChunkTemplatePlugin = require ( "../lib/node/NodeHotUpdateChunkTemplatePlugin" ) ;
7+ const applyPluginWithOptions = require ( "./helpers/applyPluginWithOptions" ) ;
98
10- beforeEach ( function ( ) {
9+ describe ( "NodeHotUpdateChunkTemplatePlugin" , ( ) => {
10+ let handlerContext ;
11+
12+ beforeEach ( ( ) => {
1113 handlerContext = {
1214 outputOptions : {
1315 hotUpdateFunction : "Foo" ,
@@ -16,52 +18,40 @@ describe("NodeHotUpdateChunkTemplatePlugin", function() {
1618 } ;
1719 } ) ;
1820
19- it ( "has apply function" , function ( ) {
20- ( new NodeHotUpdateChunkTemplatePlugin ( ) ) . apply . should . be . a . Function ( ) ;
21- } ) ;
21+ it ( "has apply function" , ( ) => ( new NodeHotUpdateChunkTemplatePlugin ( ) ) . 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 ( NodeHotUpdateChunkTemplatePlugin ) ;
28- } ) ;
26+ beforeEach ( ( ) => eventBindings = applyPluginWithOptions ( NodeHotUpdateChunkTemplatePlugin ) ) ;
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- it ( "creates source wrapper with export" , function ( ) {
44- var source = eventBinding . handler . call ( handlerContext , "moduleSource()" , [ ] , [ ] , { } , 100 ) ;
35+ it ( "creates source wrapper with export" , ( ) => {
36+ const source = eventBinding . handler . call ( handlerContext , "moduleSource()" , [ ] , [ ] , { } , 100 ) ;
4537 source . should . be . instanceof ( ConcatSource ) ;
4638 source . source ( ) . should . be . exactly ( "exports.id = 100;\nexports.modules = moduleSource();" ) ;
4739 } ) ;
4840 } ) ;
4941
50- describe ( "hash handler" , function ( ) {
51- var hashMock ;
42+ describe ( "hash handler" , ( ) => {
43+ let hashMock ;
5244
53- beforeEach ( function ( ) {
45+ beforeEach ( ( ) => {
5446 eventBinding = eventBindings [ 1 ] ;
5547 hashMock = {
5648 update : sinon . spy ( )
5749 } ;
5850 } ) ;
5951
60- it ( "binds to hash event" , function ( ) {
61- eventBinding . name . should . be . exactly ( "hash" ) ;
62- } ) ;
52+ it ( "binds to hash event" , ( ) => eventBinding . name . should . be . exactly ( "hash" ) ) ;
6353
64- it ( "updates hash object" , function ( ) {
54+ it ( "updates hash object" , ( ) => {
6555 eventBinding . handler . call ( handlerContext , hashMock ) ;
6656 hashMock . update . callCount . should . be . exactly ( 4 ) ;
6757 sinon . assert . calledWith ( hashMock . update , "NodeHotUpdateChunkTemplatePlugin" ) ;
0 commit comments