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