Skip to content

Commit 4d12420

Browse files
committed
refactor(ES6): HotUpdateChunkTemplate.test.js
1 parent d9ac043 commit 4d12420

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

test/HotUpdateChunkTemplate.test.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
var should = require("should");
2-
var sinon = require("sinon");
3-
var HotUpdateChunkTemplate = require("../lib/HotUpdateChunkTemplate");
1+
"use strict";
42

5-
describe("HotUpdateChunkTemplate", function() {
6-
var env;
3+
const should = require("should");
4+
const sinon = require("sinon");
5+
const HotUpdateChunkTemplate = require("../lib/HotUpdateChunkTemplate");
76

8-
beforeEach(function() {
7+
describe("HotUpdateChunkTemplate", () => {
8+
let env;
9+
10+
beforeEach(() => {
911
env = {
1012
myHotUpdateChunkTemplate: new HotUpdateChunkTemplate({})
1113
};
1214
});
1315

14-
describe("render", function() {
15-
beforeEach(function() {
16+
describe("render", () => {
17+
beforeEach(() => {
1618
env.renderContext = {
1719
renderChunkModules: sinon.spy(),
1820
applyPluginsWaterfall: sinon.spy()
1921
};
20-
var renderArguments = [
22+
const renderArguments = [
2123
"id", ["module1", "module2"],
2224
["module3", "module4"],
2325
{},
@@ -27,23 +29,23 @@ describe("HotUpdateChunkTemplate", function() {
2729
env.pluginsCall = env.renderContext.applyPluginsWaterfall;
2830
});
2931

30-
it("renders chunk modules", function() {
32+
it("renders chunk modules", () => {
3133
env.renderContext.renderChunkModules.callCount.should.be.exactly(1);
3234
});
3335

34-
it("applies modules plugins", function() {
36+
it("applies modules plugins", () => {
3537
env.pluginsCall.callCount.should.be.exactly(2);
3638
env.pluginsCall.firstCall.args[0].should.be.exactly("modules");
3739
});
3840

39-
it("applies render plugins", function() {
41+
it("applies render plugins", () => {
4042
env.pluginsCall.callCount.should.be.exactly(2);
4143
env.pluginsCall.secondCall.args[0].should.be.exactly("render");
4244
});
4345
});
4446

45-
describe("updateHash", function() {
46-
beforeEach(function() {
47+
describe("updateHash", () => {
48+
beforeEach(() => {
4749
env.hash = {
4850
update: sinon.spy()
4951
};
@@ -53,13 +55,13 @@ describe("HotUpdateChunkTemplate", function() {
5355
env.myHotUpdateChunkTemplate.updateHash.call(env.updateHashContext, env.hash);
5456
});
5557

56-
it("updates hash", function() {
58+
it("updates hash", () => {
5759
env.hash.update.callCount.should.be.exactly(2);
5860
env.hash.update.firstCall.args[0].should.be.exactly("HotUpdateChunkTemplate");
5961
env.hash.update.secondCall.args[0].should.be.exactly("1");
6062
});
6163

62-
it("applies hash plugin", function() {
64+
it("applies hash plugin", () => {
6365
env.updateHashContext.applyPlugins.callCount.should.be.exactly(1);
6466
env.updateHashContext.applyPlugins.firstCall.args[0].should.be.exactly("hash");
6567
env.updateHashContext.applyPlugins.firstCall.args[1].should.be.exactly(env.hash);

0 commit comments

Comments
 (0)