Skip to content

Commit c5a31d5

Browse files
committed
refactor(ES6): DependenciesBlockVariable.test.js
1 parent d9ac043 commit c5a31d5

1 file changed

Lines changed: 37 additions & 45 deletions

File tree

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
var should = require("should");
2-
var sinon = require("sinon");
3-
var DependenciesBlockVariable = require("../lib/DependenciesBlockVariable");
1+
"use strict";
42

5-
describe("DependenciesBlockVariable", function() {
6-
var DependenciesBlockVariableInstance,
3+
const should = require("should");
4+
const sinon = require("sinon");
5+
const DependenciesBlockconstiable = require("../lib/DependenciesBlockvariable");
6+
7+
describe("DependenciesBlockconstiable", () => {
8+
let DependenciesBlockconstiableInstance,
79
dependencyMock,
810
sandbox;
911

10-
before(function() {
12+
before(() => {
1113
sandbox = sinon.sandbox.create();
1214
dependencyMock = {
1315
constructor: {
@@ -16,83 +18,73 @@ describe("DependenciesBlockVariable", function() {
1618
disconnect: sandbox.spy(),
1719
updateHash: sandbox.spy()
1820
};
19-
DependenciesBlockVariableInstance = new DependenciesBlockVariable(
21+
DependenciesBlockconstiableInstance = new DependenciesBlockconstiable(
2022
"dependencies-name",
2123
"expression", [dependencyMock]);
2224
});
2325

24-
afterEach(function() {
25-
sandbox.restore();
26-
});
26+
afterEach(() => sandbox.restore());
2727

28-
describe("hasDependencies", function() {
29-
it("returns `true` if has dependencies", function() {
30-
should(DependenciesBlockVariableInstance.hasDependencies()).be.true();
31-
});
32-
});
28+
describe("hasDependencies", () =>
29+
it("returns `true` if has dependencies", () =>
30+
should(DependenciesBlockconstiableInstance.hasDependencies()).be.true()));
3331

34-
describe("disconnect", function() {
35-
it("trigger dependencies disconnection", function() {
36-
DependenciesBlockVariableInstance.disconnect();
32+
describe("disconnect", () =>
33+
it("trigger dependencies disconnection", () => {
34+
DependenciesBlockconstiableInstance.disconnect();
3735
should(dependencyMock.disconnect.calledOnce).be.true();
38-
});
39-
});
36+
}));
4037

41-
describe("updateHash", function() {
42-
var hash;
43-
before(function() {
38+
describe("updateHash", () => {
39+
let hash;
40+
before(() => {
4441
hash = {
4542
update: sandbox.spy()
4643
};
47-
DependenciesBlockVariableInstance.updateHash(hash);
44+
DependenciesBlockconstiableInstance.updateHash(hash);
4845
});
4946

50-
it("should update hash dependencies with name", function() {
51-
should(hash.update.calledWith("dependencies-name")).be.true();
52-
});
47+
it("should update hash dependencies with name", () =>
48+
should(hash.update.calledWith("dependencies-name")).be.true());
5349

54-
it("should update hash dependencies with expression", function() {
55-
should(hash.update.calledWith("expression")).be.true();
56-
});
50+
it("should update hash dependencies with expression", () =>
51+
should(hash.update.calledWith("expression")).be.true());
5752

58-
it("should update hash inside dependencies", function() {
59-
should(dependencyMock.updateHash.calledOnce).be.true();
60-
});
53+
it("should update hash inside dependencies", () =>
54+
should(dependencyMock.updateHash.calledOnce).be.true());
6155
});
6256

63-
describe("expressionSource", function() {
64-
var dependencyTemplates,
57+
describe("expressionSource", () => {
58+
let dependencyTemplates,
6559
applyMock;
6660

67-
before(function() {
68-
applyMock = sandbox.spy();
69-
});
61+
before(() => applyMock = sandbox.spy());
7062

71-
it("aplies information inside dependency templates", function() {
63+
it("aplies information inside dependency templates", () => {
7264
dependencyTemplates = {
7365
get: function() {
7466
return {
7567
apply: applyMock
7668
};
7769
}
7870
};
79-
DependenciesBlockVariableInstance.expressionSource(
71+
DependenciesBlockconstiableInstance.expressionSource(
8072
dependencyTemplates, {}, {}
8173
);
8274
should(applyMock.calledOnce).be.true();
8375
});
8476

85-
it("aplies information inside dependency templates", function() {
77+
it("aplies information inside dependency templates", () => {
8678
dependencyTemplates = {
8779
get: function() {
8880
return false;
8981
}
9082
};
91-
should(function() {
92-
DependenciesBlockVariableInstance.expressionSource(
83+
should(() => {
84+
DependenciesBlockconstiableInstance.expressionSource(
9385
dependencyTemplates, {}, {}
94-
)
86+
);
9587
}).throw("No template for dependency: DependencyMock");
96-
})
88+
});
9789
});
9890
});

0 commit comments

Comments
 (0)