webpack/test/NullDependency.unittest.js

40 lines
1.0 KiB
JavaScript
Raw Normal View History

2017-02-18 02:39:13 +08:00
"use strict";
2017-11-15 21:08:11 +08:00
require("should");
2017-02-18 02:02:19 +08:00
const sinon = require("sinon");
const NullDependency = require("../lib/dependencies/NullDependency");
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
describe("NullDependency", () => {
let env;
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
beforeEach(() => env = {});
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
it("is a function", () => NullDependency.should.be.a.Function());
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
describe("when created", () => {
beforeEach(() => env.nullDependency = new NullDependency());
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
it("has a null type", () => env.nullDependency.type.should.be.exactly("null"));
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
it("has update hash function", () => env.nullDependency.updateHash.should.be.Function());
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
it("does not update hash", () => {
2017-01-17 06:19:11 +08:00
const hash = {
update: sinon.stub()
};
env.nullDependency.updateHash(hash);
hash.update.called.should.be.false();
});
});
2017-02-18 02:02:19 +08:00
describe("Template", () => {
it("is a function", () => NullDependency.Template.should.be.a.Function());
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
describe("when created", () => {
beforeEach(() => env.nullDependencyTemplate = new NullDependency.Template());
2017-01-17 06:19:11 +08:00
2017-02-18 02:02:19 +08:00
it("has apply function", () => env.nullDependencyTemplate.apply.should.be.Function());
2017-01-17 06:19:11 +08:00
});
});
});