22
33const tap = require ( 'tap' ) ;
44const rewire = require ( "rewire" ) ;
5- const _ = require ( 'lodash' ) ;
65const fs = require ( 'fs-extra' ) ;
76var config = require ( './util/patternlab-config.json' ) ;
87
98var plEngineModule = rewire ( '../core/lib/patternlab' ) ;
109
1110//set up a global mocks - we don't want to be writing/rendering any files right now
12- const uiBuilderMock = function ( ) {
13- return {
14- buildFrontend : function ( ) { }
15- } ;
16- } ;
17-
1811const fsMock = {
1912 outputFileSync : function ( path , content ) { /* INTENTIONAL NOOP */ } ,
2013 readJSONSync : function ( path , encoding ) {
@@ -23,15 +16,14 @@ const fsMock = {
2316 removeSync : function ( path ) { fs . removeSync ( path ) ; } ,
2417 emptyDirSync : function ( path ) { fs . emptyDirSync ( path ) ; } ,
2518 readFileSync : function ( path , encoding ) { return fs . readFileSync ( path , encoding ) ; } ,
26- }
19+ } ;
2720
2821//set our mocks in place of usual require()
2922plEngineModule . __set__ ( {
30- 'ui_builder' : uiBuilderMock ,
3123 'fs' : fsMock
3224} ) ;
3325
34- tap . test ( 'buildPatternData - should merge all JSON files in the data folder except listitems' , function ( test ) {
26+ tap . test ( 'buildPatternData - should merge all JSON files in the data folder except listitems' , function ( test ) {
3527 var data_dir = './test/files/_data/' ;
3628
3729 var pl = new plEngineModule ( config ) ;
@@ -42,7 +34,7 @@ tap.test('buildPatternData - should merge all JSON files in the data folder exce
4234 test . end ( ) ;
4335} ) ;
4436
45- tap . test ( 'buildPatternData - can load json, yaml, and yml files' , function ( test ) {
37+ tap . test ( 'buildPatternData - can load json, yaml, and yml files' , function ( test ) {
4638 const data_dir = './test/files/_data/' ;
4739
4840 var pl = new plEngineModule ( config ) ;
0 commit comments