-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunit.ts
46 lines (41 loc) · 1.63 KB
/
unit.ts
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
import { Step } from "@shanzhai/interfaces";
import { htmlHeaderStore } from "@shanzhai/html-header-store";
import { pugLocalStore } from "@shanzhai/pug-local-store";
import { KeyedStoreSetOutput } from "@shanzhai/keyed-store-set-output";
import { ConcatenateObjectValuesInput } from "@shanzhai/concatenate-object-values-input";
import { CopyStep } from "@shanzhai/copy-step";
import { WrapInObjectOutput } from "@shanzhai/wrap-in-object-output";
import { KeyedStoreGetAllInput } from "@shanzhai/keyed-store-get-all-input";
import htmlHeaderPugLocalPlugin = require(".");
describe(`html-header-pug-local-plugin`, () => {
it(`is triggered by the expected stores`, () => {
expect(htmlHeaderPugLocalPlugin.triggers.htmlHeaderPugLocal.stores).toEqual(
[htmlHeaderStore]
);
});
it(`advertises the stores it will write to`, () => {
expect(
htmlHeaderPugLocalPlugin.triggers.htmlHeaderPugLocal.writesToStores
).toEqual(jasmine.arrayWithExactContents([pugLocalStore]));
});
describe(`when the favicons options are set`, () => {
let step: Step;
beforeAll(() => {
step = htmlHeaderPugLocalPlugin.triggers.htmlHeaderPugLocal.invalidated();
});
it(`copies the concatenated HTML headers to the Pug locals store`, () => {
expect(step).toEqual(
new CopyStep(
`Copy HTML headers to Pug locals`,
new ConcatenateObjectValuesInput(
new KeyedStoreGetAllInput(htmlHeaderStore)
),
new WrapInObjectOutput(
`headers`,
new KeyedStoreSetOutput(pugLocalStore, `htmlHeaderPugLocalPlugin`)
)
)
);
});
});
});