@@ -7,12 +7,18 @@ import Models from '../../src/models';
77
88const rootPath = path . join ( __dirname , '../../example/vueFiles/' ) ;
99const defaults = new Models . Defaults ( ) ;
10+ var LRU = require ( 'lru-cache' ) ;
11+ var cacheOptions = {
12+ max : 500 ,
13+ maxAge : 1000 * 60 * 60
14+ } ;
15+ var lruCache = LRU ( cacheOptions ) ;
1016
1117test ( 'correctPath Path' , t => {
1218 const filePath = path . join ( rootPath , '../../example/vueFiles/components/uuid.vue' ) ;
1319 const correctPath = rootPath + 'components/uuid.vue' ;
1420
15- return PathUtils . getCorrectPathForFile ( filePath , 'view' , defaults )
21+ return PathUtils . getCorrectPathForFile ( filePath , 'view' , defaults , lruCache )
1622 . then ( returnedPath => {
1723 t . is ( returnedPath . path , correctPath ) ;
1824 } )
@@ -25,7 +31,7 @@ test('shows error for fake test Path ', t => {
2531 const filePath = path . join ( rootPath , 'componentDoesntExist.vue' ) ;
2632 const errMessage = `Could not find test file at ${ rootPath } componentDoesntExist.vue`
2733
28- return PathUtils . getCorrectPathForFile ( filePath , 'test' , defaults )
34+ return PathUtils . getCorrectPathForFile ( filePath , 'test' , defaults , lruCache )
2935 . catch ( error => {
3036 console . log ( error )
3137 t . is ( error . message , errMessage ) ;
0 commit comments