Skip to content

Commit 9472bfc

Browse files
committed
Create categoriesHandlers.class.test.js
1 parent 2312256 commit 9472bfc

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import Categories from "../../src/lib/categoriesHandlers.class.js"
2+
3+
const firstTestCategories = ["accessibility"]
4+
const secondTestCategories = ["accessibility", "seo", "pwa"]
5+
6+
test('getCategories from an Array', () => {
7+
expect(
8+
Categories.getFlags(firstTestCategories)
9+
).toStrictEqual("--only-categories=accessibility ");
10+
});
11+
12+
test('getCategories from an Array with more than one item', () => {
13+
expect(
14+
Categories.getFlags(secondTestCategories)
15+
).toStrictEqual("--only-categories=accessibility,seo,pwa ");
16+
});
17+
18+
test('getCurrent from Array', () => {
19+
expect(
20+
Categories.getCurrent(firstTestCategories)
21+
).toStrictEqual(["accessibility"])
22+
});
23+
24+
test('getCurrent from Array with more than one item', () => {
25+
expect(
26+
Categories.getCurrent(secondTestCategories)
27+
).toStrictEqual(["accessibility", "seo", "pwa"])
28+
});
29+
30+
test('lighthouse from Array', () => {
31+
expect(
32+
Categories.lighthouse(firstTestCategories)
33+
).toStrictEqual("accessibility")
34+
})
35+
36+
test('lighthouse from Array with more than one item', () => {
37+
expect(
38+
Categories.lighthouse(secondTestCategories)
39+
).toStrictEqual("accessibility,seo,pwa")
40+
})
41+
42+
test('getFromFlags from Array', () => {
43+
expect(
44+
Categories.getFromFlags(firstTestCategories)
45+
).toStrictEqual(["accessibility"])
46+
})
47+
48+
test('getFromFlags from empty Array', () => {
49+
expect(
50+
Categories.getFromFlags([])
51+
).toBe(undefined)
52+
})

0 commit comments

Comments
 (0)