-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunit.ts
42 lines (37 loc) · 1.27 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
import { Step } from "@shanzhai/interfaces";
import { WriteFileStep } from "@shanzhai/write-file-step";
import { zipStore } from "@shanzhai/zip-store";
import { UnkeyedStoreGetInput } from "@shanzhai/unkeyed-store-get-input";
import { CreateDirectoryStep } from "@shanzhai/create-directory-step";
import { SerialStep } from "@shanzhai/serial-step";
import outputZipPlugin = require(".");
describe(`output-zip-plugin`, () => {
it(`is triggered by the expected stores`, () => {
expect(outputZipPlugin.triggers.outputZip.stores).toEqual([zipStore]);
});
it(`advertises the stores it will write to`, () => {
expect(
expect(outputZipPlugin.triggers.outputZip.writesToStores).toEqual(
jasmine.arrayWithExactContents([])
)
);
});
describe(`when the zip is set`, () => {
let step: Step;
beforeAll(() => {
step = outputZipPlugin.triggers.outputZip.invalidated();
});
it(`writes the tsconfig to disk`, () => {
expect(step).toEqual(
new SerialStep(`Output zip`, [
new CreateDirectoryStep(`Create "dist" directory`, [`dist`]),
new WriteFileStep(
`Output zip`,
[`dist`, `distributable.zip`],
new UnkeyedStoreGetInput(zipStore)
),
])
);
});
});
});