|
1 | | -var should = require("should"); |
2 | | -var path = require("path"); |
3 | | -var Chunk = require("../lib/Chunk"); |
| 1 | +"use strict"; |
4 | 2 |
|
5 | | -describe("Chunk", function() { |
6 | | - var ChunkInstance; |
| 3 | +const should = require("should"); |
| 4 | +const path = require("path"); |
| 5 | +const Chunk = require("../lib/Chunk"); |
7 | 6 |
|
8 | | - beforeEach(function() { |
9 | | - ChunkInstance = new Chunk("chunk-test", "module-test", "loc-test"); |
10 | | - }); |
| 7 | +describe("Chunk", () => { |
| 8 | + let ChunkInstance; |
11 | 9 |
|
12 | | - it("should have debugId more than 100", function() { |
13 | | - should(ChunkInstance.debugId).be.above(100); |
14 | | - }); |
| 10 | + beforeEach(() => ChunkInstance = new Chunk("chunk-test", "module-test", "loc-test")); |
15 | 11 |
|
16 | | - it("returns a string with modules information", function() { |
17 | | - should(ChunkInstance.toString()).be.exactly("Chunk[]"); |
18 | | - }) |
| 12 | + it("should have debugId more than 100", () => should(ChunkInstance.debugId).be.above(100)); |
19 | 13 |
|
20 | | - it("should have origins based in constructor information", function() { |
| 14 | + it("returns a string with modules information", () => should(ChunkInstance.toString()).be.exactly("Chunk[]")); |
| 15 | + |
| 16 | + it("should have origins based in constructor information", () => |
21 | 17 | should(ChunkInstance.origins[0]).be.eql({ |
22 | 18 | module: "module-test", |
23 | 19 | loc: "loc-test", |
24 | 20 | name: "chunk-test" |
25 | | - }) |
26 | | - }); |
| 21 | + })); |
27 | 22 |
|
28 | | - it("should not be the initial instance", function() { |
29 | | - should(ChunkInstance.isInitial()).be.false(); |
30 | | - }); |
| 23 | + it("should not be the initial instance", () => should(ChunkInstance.isInitial()).be.false()); |
31 | 24 |
|
32 | | - describe("entry", function() { |
33 | | - it("returns an error if get entry", function() { |
34 | | - should(function() { |
35 | | - var entryTest = ChunkInstance.entry; |
36 | | - }).throw("Chunk.entry was removed. Use hasRuntime()"); |
37 | | - }); |
| 25 | + describe("entry", () => { |
| 26 | + it("returns an error if get entry", () => |
| 27 | + should(() => { |
| 28 | + const entryTest = ChunkInstance.entry; |
| 29 | + }).throw("Chunk.entry was removed. Use hasRuntime()")); |
38 | 30 |
|
39 | | - it("returns an error if set an entry", function() { |
40 | | - should(function() { |
| 31 | + it("returns an error if set an entry", () => |
| 32 | + should(() => { |
41 | 33 | ChunkInstance.entry = 10; |
42 | | - }).throw("Chunk.entry was removed. Use hasRuntime()"); |
43 | | - }); |
| 34 | + }).throw("Chunk.entry was removed. Use hasRuntime()")); |
44 | 35 | }); |
45 | 36 |
|
46 | | - describe("initial", function() { |
47 | | - it("returns an error if get initial", function() { |
48 | | - should(function() { |
49 | | - var initialTest = ChunkInstance.initial; |
50 | | - }).throw("Chunk.initial was removed. Use isInitial()"); |
51 | | - }); |
| 37 | + describe("initial", () => { |
| 38 | + it("returns an error if get initial", () => |
| 39 | + should(() => { |
| 40 | + const initialTest = ChunkInstance.initial; |
| 41 | + }).throw("Chunk.initial was removed. Use isInitial()")); |
52 | 42 |
|
53 | | - it("returns an error if set an initial", function() { |
54 | | - should(function() { |
| 43 | + it("returns an error if set an initial", () => |
| 44 | + should(() => { |
55 | 45 | ChunkInstance.initial = 10; |
56 | | - }).throw("Chunk.initial was removed. Use isInitial()"); |
57 | | - }); |
| 46 | + }).throw("Chunk.initial was removed. Use isInitial()")); |
58 | 47 | }); |
59 | 48 |
|
60 | | - describe("hasRuntime", function() { |
61 | | - it("returns false", function() { |
62 | | - should(ChunkInstance.hasRuntime()).be.false(); |
63 | | - }); |
| 49 | + describe("hasRuntime", () => { |
| 50 | + it("returns false", () => should(ChunkInstance.hasRuntime()).be.false()); |
64 | 51 | }); |
65 | 52 |
|
66 | | - describe("isEmpty", function() { |
67 | | - it("should NOT have any module by default", function() { |
68 | | - should(ChunkInstance.isEmpty()).be.true(); |
69 | | - }); |
| 53 | + describe("isEmpty", () => { |
| 54 | + it("should NOT have any module by default", () => should(ChunkInstance.isEmpty()).be.true()); |
70 | 55 | }); |
71 | 56 |
|
72 | | - describe("size", function() { |
73 | | - it("should NOT have any module by default", function() { |
| 57 | + describe("size", () => { |
| 58 | + it("should NOT have any module by default", () => |
74 | 59 | should(ChunkInstance.size({ |
75 | 60 | chunkOverhead: 10, |
76 | 61 | entryChunkMultiplicator: 2 |
77 | | - })).be.exactly(10); |
78 | | - }); |
| 62 | + })).be.exactly(10)); |
79 | 63 | }); |
80 | 64 |
|
81 | | - describe("checkConstraints", function() { |
82 | | - it("throws an error", function() { |
83 | | - should(function() { |
| 65 | + describe("checkConstraints", () => { |
| 66 | + it("throws an error", () => |
| 67 | + should(() => { |
84 | 68 | ChunkInstance.checkConstraints(); |
85 | | - }).not.throw(/checkConstraints/); |
86 | | - }); |
| 69 | + }).not.throw(/checkConstraints/)); |
87 | 70 | }); |
88 | 71 |
|
89 | | - describe("canBeIntegrated", function() { |
90 | | - it("returns `false` if other object is initial", function() { |
91 | | - var other = { |
92 | | - isInitial: function() { |
93 | | - return true |
94 | | - } |
| 72 | + describe("canBeIntegrated", () => { |
| 73 | + it("returns `false` if other object is initial", () => { |
| 74 | + const other = { |
| 75 | + isInitial: () => true |
95 | 76 | }; |
96 | 77 | should(ChunkInstance.canBeIntegrated(other)).be.false(); |
97 | 78 | }); |
98 | 79 |
|
99 | | - it("returns `true` if other object and chunk instance are NOT initial", function() { |
100 | | - var other = { |
101 | | - isInitial: function() { |
102 | | - return false |
103 | | - } |
| 80 | + it("returns `true` if other object and chunk instance are NOT initial", () => { |
| 81 | + const other = { |
| 82 | + isInitial: () => false |
104 | 83 | }; |
105 | 84 | should(ChunkInstance.canBeIntegrated(other)).be.true(); |
106 | 85 | }); |
|
0 commit comments