-
-
Notifications
You must be signed in to change notification settings - Fork 251
/
index.test.ts
38 lines (32 loc) · 1.08 KB
/
index.test.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
import purgeJsx from "../src/index";
import { TEST_1_CONTENT, TEST_1_TAG, TEST_1_CLASS, TEST_1_ID } from "./data";
const plugin = purgeJsx({sourceType: "module"});
describe("purgePug", () => {
describe("from a normal html document", () => {
it("finds tag selectors", () => {
const received = plugin(TEST_1_CONTENT);
for (const item of TEST_1_TAG) {
expect(received.includes(item)).toBe(true);
}
});
it("finds classes selectors", () => {
const received = plugin(TEST_1_CONTENT);
for (const item of TEST_1_CLASS) {
expect(received.includes(item)).toBe(true);
}
});
it("finds id selectors", () => {
const received = plugin(TEST_1_CONTENT);
for (const item of TEST_1_ID) {
expect(received.includes(item)).toBe(true);
}
});
it("finds all selectors", () => {
const received = plugin(TEST_1_CONTENT);
const selectors = [...TEST_1_TAG, ...TEST_1_CLASS, ...TEST_1_ID];
for (const item of selectors) {
expect(received.includes(item)).toBe(true);
}
});
});
});