Skip to content

Commit 8d9149b

Browse files
authored
Merge pull request webpack#4005 from shubheksha/refactor-test-CaseSensitiveModulesWarning
refactor(ES6): CaseSensitiveModulesWarning.test.js
2 parents a33067c + 52c28f0 commit 8d9149b

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
var should = require("should");
2-
var CaseSensitiveModulesWarning = require("../lib/CaseSensitiveModulesWarning");
1+
"use strict";
32

4-
var createModule = function(identifier, numberOfReasons) {
5-
var reasons = new Array(numberOfReasons || 0).fill(null).map(function(value, index) {
3+
const should = require("should");
4+
const CaseSensitiveModulesWarning = require("../lib/CaseSensitiveModulesWarning");
5+
6+
const createModule = function(identifier, numberOfReasons) {
7+
const reasons = new Array(numberOfReasons || 0).fill(null).map((value, index) => {
68
return {
79
module: createModule(`${identifier}-reason-${index}`)
810
};
@@ -14,23 +16,22 @@ var createModule = function(identifier, numberOfReasons) {
1416
};
1517
};
1618

17-
describe("CaseSensitiveModulesWarning", function() {
18-
var myCaseSensitiveModulesWarning, modules;
19+
describe("CaseSensitiveModulesWarning", () => {
20+
let myCaseSensitiveModulesWarning;
21+
let modules;
1922

20-
beforeEach(function() {
23+
beforeEach(() => {
2124
modules = [
22-
createModule('FOOBAR'),
23-
createModule('FooBar', 1),
24-
createModule('foobar', 2)
25+
createModule("FOOBAR"),
26+
createModule("FooBar", 1),
27+
createModule("foobar", 2)
2528
];
2629
myCaseSensitiveModulesWarning = new CaseSensitiveModulesWarning(modules);
2730
});
2831

29-
it('has the a name', function() {
30-
myCaseSensitiveModulesWarning.name.should.be.exactly('CaseSensitiveModulesWarning');
31-
});
32+
it("has the a name", () => myCaseSensitiveModulesWarning.name.should.be.exactly("CaseSensitiveModulesWarning"));
3233

33-
it('has the a message', function() {
34+
it("has the a message", () => {
3435
myCaseSensitiveModulesWarning.message.should.be.exactly(`
3536
There are multiple modules with names that only differ in casing.
3637
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
@@ -45,11 +46,9 @@ Use equal casing. Compare these module identifiers:
4546
`.trim());
4647
});
4748

48-
it('has the an origin', function() {
49-
myCaseSensitiveModulesWarning.origin.should.be.exactly(modules[0]);
50-
});
49+
it("has the an origin", () =>
50+
myCaseSensitiveModulesWarning.origin.should.be.exactly(modules[0]));
5151

52-
it('has the a module', function() {
53-
myCaseSensitiveModulesWarning.module.should.be.exactly(modules[0]);
54-
});
52+
it('has the a module', () =>
53+
myCaseSensitiveModulesWarning.module.should.be.exactly(modules[0]));
5554
});

0 commit comments

Comments
 (0)