Skip to content

Commit 0460726

Browse files
authored
Merge pull request webpack#4049 from shubheksha/refactor-test-Template
refactor(ES6): Template.test.js
2 parents 22352b8 + 3f19ac5 commit 0460726

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎test/Template.test.js‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
var should = require("should");
2-
var path = require("path");
1+
"use strict";
32

4-
var template = require("../lib/Template");
3+
const should = require("should");
54

6-
describe("Template", function() {
7-
it("should generate valid identifiers", function() {
8-
template.toIdentifier("0abc-def9").should.equal("_abc_def9");
9-
});
10-
it("should generate valid number identifiers", function() {
11-
var items = [];
12-
var item;
13-
for(var i = 0; i < 80; i += 1) {
5+
const template = require("../lib/Template");
6+
7+
describe("Template", () => {
8+
it("should generate valid identifiers", () =>
9+
template.toIdentifier("0abc-def9").should.equal("_abc_def9"));
10+
it("should generate valid number identifiers", () => {
11+
const items = [];
12+
let item;
13+
for(let i = 0; i < 80; i += 1) {
1414
item = template.numberToIdentifer(i);
15-
if(item === '') {
16-
throw new Error('empty number identifier');
15+
if(item === "") {
16+
throw new Error("empty number identifier");
1717
} else if(items.indexOf(item) > -1) {
18-
throw new Error('duplicate number identifier');
18+
throw new Error("duplicate number identifier");
1919
} else {
2020
items.push(item);
2121
}

0 commit comments

Comments
 (0)