forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNullDependency.unittest.js
49 lines (38 loc) · 1.09 KB
/
NullDependency.unittest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"use strict";
const NullDependency = require("../lib/dependencies/NullDependency");
describe("NullDependency", () => {
let env;
beforeEach(() => (env = {}));
it("is a function", () => {
expect(NullDependency).toBeTypeOf("function");
});
describe("when created", () => {
beforeEach(() => (env.nullDependency = new NullDependency()));
it("has a null type", () => {
expect(env.nullDependency.type).toBe("null");
});
it("has update hash function", () => {
expect(env.nullDependency.updateHash).toBeTypeOf("function");
});
it("does not update hash", () => {
const hash = {
update: jest.fn()
};
env.nullDependency.updateHash(hash);
expect(hash.update).not.toHaveBeenCalled();
});
});
describe("Template", () => {
it("is a function", () => {
expect(NullDependency.Template).toBeTypeOf("function");
});
describe("when created", () => {
beforeEach(() => {
env.nullDependencyTemplate = new NullDependency.Template();
});
it("has apply function", () => {
expect(env.nullDependencyTemplate.apply).toBeTypeOf("function");
});
});
});
});