forked from GovAlta/design-tokens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.spec.js
30 lines (26 loc) · 975 Bytes
/
index.spec.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
const SC = require("./lib/design-tokens");
const rm = require("rimraf");
const fs = require("fs");
describe("GoA Design Tokens", () => {
beforeEach((next) => {
rm("./tmp", next);
console.log = () => { }; // one of the libs has some console.log statements
});
it("should create css and scss files", async () => {
SC.generate("./tmp");
const cssfiles = fs.readdirSync("./tmp/dist");
expect(cssfiles.length).toBe(2);
expect(cssfiles[0]).toBe(`tokens.css`);
expect(cssfiles[1]).toBe(`tokens.scss`);
});
it("should create valid css output", async () => {
SC.generate("./tmp");
const raw = fs.readFileSync("./tmp/dist/tokens.css", { encoding: "utf8" });
expect(raw).not.toContain("[object Object]");
});
it("should create valid scss output", async () => {
SC.generate("./tmp");
const raw = fs.readFileSync("./tmp/dist/tokens.scss", { encoding: "utf8" });
expect(raw).not.toContain("[object Object]");
});
});