|
1 | | -var RawModule = require("../lib/RawModule"); |
2 | | -var OriginalSource = require("webpack-sources").OriginalSource; |
3 | | -var RawSource = require("webpack-sources").RawSource; |
4 | | -var RequestShortener = require("../lib/RequestShortener"); |
5 | | -var should = require("should"); |
6 | | -var path = require("path") |
7 | | - |
8 | | -describe("RawModule", function() { |
9 | | - var myRawModule; |
10 | | - |
11 | | - before(function() { |
12 | | - var source = 'sourceStr attribute'; |
13 | | - var identifier = 'identifierStr attribute'; |
14 | | - var readableIdentifier = 'readableIdentifierStr attribute'; |
| 1 | +"use strict"; |
| 2 | + |
| 3 | +const RawModule = require("../lib/RawModule"); |
| 4 | +const OriginalSource = require("webpack-sources").OriginalSource; |
| 5 | +const RawSource = require("webpack-sources").RawSource; |
| 6 | +const RequestShortener = require("../lib/RequestShortener"); |
| 7 | +const should = require("should"); |
| 8 | +const path = require("path"); |
| 9 | + |
| 10 | +describe("RawModule", () => { |
| 11 | + let myRawModule; |
| 12 | + |
| 13 | + before(() => { |
| 14 | + const source = "sourceStr attribute"; |
| 15 | + const identifier = "identifierStr attribute"; |
| 16 | + const readableIdentifier = "readableIdentifierStr attribute"; |
15 | 17 | myRawModule = new RawModule(source, identifier, readableIdentifier); |
16 | 18 | }); |
17 | 19 |
|
18 | | - describe('identifier', function() { |
19 | | - it('returns value for identifierStr attribute', function() { |
20 | | - should(myRawModule.identifier()).be.exactly('identifierStr attribute'); |
21 | | - }); |
| 20 | + describe("identifier", () => { |
| 21 | + it("returns value for identifierStr attribute", () => |
| 22 | + should(myRawModule.identifier()).be.exactly("identifierStr attribute")); |
22 | 23 | }); |
23 | 24 |
|
24 | | - describe('size', function() { |
25 | | - it('returns value for sourceStr attribute\'s length property', function() { |
26 | | - var sourceStrLength = myRawModule.sourceStr.length; |
| 25 | + describe("size", () => { |
| 26 | + it("returns value for sourceStr attribute\"s length property", () => { |
| 27 | + const sourceStrLength = myRawModule.sourceStr.length; |
27 | 28 | should(myRawModule.size()).be.exactly(sourceStrLength); |
28 | 29 | }); |
29 | 30 | }); |
30 | 31 |
|
31 | | - describe('readableIdentifier', function() { |
32 | | - it('returns result of calling provided requestShortener\'s shorten method\ |
33 | | - on readableIdentifierStr attribute', function() { |
34 | | - var requestShortener = new RequestShortener(path.resolve()); |
35 | | - should.exist(myRawModule.readableIdentifier(requestShortener)); |
36 | | - }); |
| 32 | + describe("readableIdentifier", () => { |
| 33 | + it("returns result of calling provided requestShortener\"s shorten method " + |
| 34 | + "on readableIdentifierStr attribute", |
| 35 | + () => { |
| 36 | + const requestShortener = new RequestShortener(path.resolve()); |
| 37 | + should.exist(myRawModule.readableIdentifier(requestShortener)); |
| 38 | + } |
| 39 | + ); |
37 | 40 | }); |
38 | 41 |
|
39 | | - describe('needRebuild', function() { |
40 | | - it('returns false', function() { |
41 | | - should(myRawModule.needRebuild()).be.false(); |
42 | | - }); |
| 42 | + describe("needRebuild", () => { |
| 43 | + it("returns false", () => should(myRawModule.needRebuild()).be.false()); |
43 | 44 | }); |
44 | 45 |
|
45 | | - describe('source', function() { |
46 | | - it('returns a new OriginalSource instance with sourceStr attribute and\ |
47 | | - return value of identifier() function provided as constructor arguments', |
48 | | - function() { |
49 | | - var originalSource = new OriginalSource(myRawModule.sourceStr, myRawModule.identifier()); |
| 46 | + describe("source", () => { |
| 47 | + it("returns a new OriginalSource instance with sourceStr attribute and " + |
| 48 | + "return value of identifier() function provided as constructor arguments", |
| 49 | + () => { |
| 50 | + const originalSource = new OriginalSource(myRawModule.sourceStr, myRawModule.identifier()); |
50 | 51 | myRawModule.useSourceMap = true; |
51 | 52 | myRawModule.source().should.match(originalSource); |
52 | | - }); |
| 53 | + } |
| 54 | + ); |
53 | 55 |
|
54 | | - it('returns a new RawSource instance with sourceStr attribute provided\ |
55 | | - as constructor argument if useSourceMap is falsey', function() { |
56 | | - var rawSource = new RawSource(myRawModule.sourceStr); |
57 | | - myRawModule.useSourceMap = false; |
58 | | - myRawModule.source().should.match(rawSource); |
59 | | - }); |
| 56 | + it("returns a new RawSource instance with sourceStr attribute provided " + |
| 57 | + "as constructor argument if useSourceMap is falsey", |
| 58 | + () => { |
| 59 | + const rawSource = new RawSource(myRawModule.sourceStr); |
| 60 | + myRawModule.useSourceMap = false; |
| 61 | + myRawModule.source().should.match(rawSource); |
| 62 | + } |
| 63 | + ); |
60 | 64 | }); |
61 | 65 | }); |
0 commit comments