File tree Expand file tree Collapse file tree 2 files changed +64
-1
lines changed Expand file tree Collapse file tree 2 files changed +64
-1
lines changed Original file line number Diff line number Diff line change 3
3
const path = require ( 'path' ) ;
4
4
const _ = require ( 'lodash' ) ;
5
5
6
- const findModules = require ( './findModules' ) ;
7
6
const logger = require ( './log' ) ;
8
7
8
+ let findModules = require ( './findModules' ) ; //eslint-disable-line prefer-const
9
9
let fs = require ( 'fs-extra' ) ; // eslint-disable-line
10
10
11
11
const uiKitMatcher = / ^ u i k i t - ( .* ) $ / ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const tap = require ( 'tap' ) ;
4
+ const rewire = require ( 'rewire' ) ;
5
+
6
+ const loaduikits = require ( '../src/lib/loaduikits' ) ;
7
+
8
+ const findModulesMock = function ( ) {
9
+ return [
10
+ {
11
+ name : 'uikit-foo' ,
12
+ modulePath : 'node_modules/@pattern-lab/uikit-foo' ,
13
+ } ,
14
+ {
15
+ name : 'uikit-bar' ,
16
+ modulePath : 'node_modules/@pattern-lab/uikit-bar' ,
17
+ } ,
18
+ {
19
+ name : 'uikit-baz' ,
20
+ modulePath : 'node_modules/@pattern-lab/uikit-baz' ,
21
+ } ,
22
+ ] ;
23
+ } ;
24
+
25
+ const fsMock = function ( ) {
26
+ readFileSync: ( ) => { } ;
27
+ } ;
28
+
29
+ tap . test ( 'loaduikits' , function ( test ) {
30
+ //arrange
31
+ const patternlab = {
32
+ uikits : [
33
+ {
34
+ name : 'uikit-foo' ,
35
+ enabled : true ,
36
+ outputDir : 'foo' ,
37
+ excludedPatternStates : [ 'legacy' ] ,
38
+ excludedTags : [ 'baz' ] ,
39
+ } ,
40
+ {
41
+ name : 'uikit-bar' ,
42
+ enabled : true ,
43
+ outputDir : 'bar' ,
44
+ excludedPatternStates : [ 'development' ] ,
45
+ excludedTags : [ 'baz' , 'foo' ] ,
46
+ } ,
47
+ {
48
+ name : 'uikit-baz' ,
49
+ enabled : false ,
50
+ outputDir : 'baz' ,
51
+ excludedPatternStates : [ '' ] ,
52
+ excludedTags : [ ] ,
53
+ } ,
54
+ ] ,
55
+ } ;
56
+
57
+ //act
58
+ loaduikits ( patternlab ) . then ( ( ) => {
59
+ //assert
60
+ test . equals ( patternlab . uikits ) ;
61
+ test . end ( ) ;
62
+ } ) ;
63
+ } ) ;
You can’t perform that action at this time.
0 commit comments