|
3 | 3 | const NullDependency = require("../lib/dependencies/NullDependency"); |
4 | 4 |
|
5 | 5 | describe("NullDependency", () => { |
| 6 | + let env; |
| 7 | + |
| 8 | + beforeEach(() => (env = {})); |
| 9 | + |
| 10 | + it("is a function", () => { |
| 11 | + expect(NullDependency).toBeTypeOf("function"); |
| 12 | + }); |
| 13 | + |
6 | 14 | describe("when created", () => { |
| 15 | + beforeEach(() => (env.nullDependency = new NullDependency())); |
| 16 | + |
7 | 17 | it("has a null type", () => { |
8 | | - const nullDependency = new NullDependency(); |
9 | | - expect(nullDependency.type).toBe("null"); |
| 18 | + expect(env.nullDependency.type).toBe("null"); |
| 19 | + }); |
| 20 | + |
| 21 | + it("has update hash function", () => { |
| 22 | + expect(env.nullDependency.updateHash).toBeTypeOf("function"); |
| 23 | + }); |
| 24 | + |
| 25 | + it("does not update hash", () => { |
| 26 | + const hash = { |
| 27 | + update: jest.fn() |
| 28 | + }; |
| 29 | + env.nullDependency.updateHash(hash); |
| 30 | + expect(hash.update).not.toHaveBeenCalled(); |
| 31 | + }); |
| 32 | + }); |
| 33 | + |
| 34 | + describe("Template", () => { |
| 35 | + it("is a function", () => { |
| 36 | + expect(NullDependency.Template).toBeTypeOf("function"); |
| 37 | + }); |
| 38 | + |
| 39 | + describe("when created", () => { |
| 40 | + beforeEach(() => { |
| 41 | + env.nullDependencyTemplate = new NullDependency.Template(); |
| 42 | + }); |
| 43 | + |
| 44 | + it("has apply function", () => { |
| 45 | + expect(env.nullDependencyTemplate.apply).toBeTypeOf("function"); |
| 46 | + }); |
10 | 47 | }); |
11 | 48 | }); |
12 | 49 | }); |
0 commit comments