Skip to content

Commit 4f5410c

Browse files
authored
Merge pull request webpack#4024 from shubheksha/refactor-test-MultiWatching
refactor(ES6): MultiWatching.test.js
2 parents 7227240 + d2ea2d8 commit 4f5410c

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

test/MultiWatching.test.js

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

5-
var createWatching = function() {
3+
const should = require("should");
4+
const sinon = require("sinon");
5+
const MultiWatching = require("../lib/MultiWatching");
6+
7+
const createWatching = function() {
68
return {
79
invalidate: sinon.spy(),
810
close: sinon.spy()
911
};
1012
};
1113

12-
describe("MultiWatching", function() {
13-
var watchings, myMultiWatching;
14+
describe("MultiWatching", () => {
15+
let watchings, myMultiWatching;
1416

15-
beforeEach(function() {
17+
beforeEach(() => {
1618
watchings = [createWatching(), createWatching()];
1719
myMultiWatching = new MultiWatching(watchings);
1820
});
1921

20-
describe('invalidate', function() {
21-
beforeEach(function() {
22-
myMultiWatching.invalidate();
23-
});
22+
describe("invalidate", () => {
23+
beforeEach(() => myMultiWatching.invalidate());
2424

25-
it('invalidates each watching', function() {
25+
it("invalidates each watching", () => {
2626
watchings[0].invalidate.callCount.should.be.exactly(1);
2727
watchings[1].invalidate.callCount.should.be.exactly(1);
2828
});
2929
});
3030

31-
describe('close', function() {
32-
var callback;
33-
var callClosedFinishedCallback = function(watching) {
34-
watching.close.getCall(0).args[0]();
35-
};
31+
describe("close", () => {
32+
let callback;
33+
const callClosedFinishedCallback = (watching) => watching.close.getCall(0).args[0]();
3634

37-
beforeEach(function() {
35+
beforeEach(() => {
3836
callback = sinon.spy();
3937
myMultiWatching.close(callback);
4038
});
4139

42-
it('closes each watching', function() {
40+
it("closes each watching", () => {
4341
watchings[0].close.callCount.should.be.exactly(1);
4442
watchings[1].close.callCount.should.be.exactly(1);
4543
});
4644

47-
it('calls callback after each watching has closed', function() {
45+
it("calls callback after each watching has closed", () => {
4846
callClosedFinishedCallback(watchings[0]);
4947
callClosedFinishedCallback(watchings[1]);
5048
callback.callCount.should.be.exactly(1);

0 commit comments

Comments
 (0)