@@ -330,10 +330,9 @@ describe('LicensePlugin', () => {
330
330
'fake-package' : fakePackage ,
331
331
} ) ;
332
332
333
- expect ( plugin . _cache ) . toEqual ( {
334
- [ path . join ( __dirname , 'fixtures' , 'fake-package-1' , 'src' ) ] : pkg ,
335
- [ path . join ( __dirname , 'fixtures' , 'fake-package-1' ) ] : pkg ,
336
- } ) ;
333
+ expect ( plugin . _cache . size ) . toBe ( 2 ) ;
334
+ expect ( plugin . _cache . get ( path . join ( __dirname , 'fixtures' , 'fake-package-1' , 'src' ) ) ) . toEqual ( pkg ) ;
335
+ expect ( plugin . _cache . get ( path . join ( __dirname , 'fixtures' , 'fake-package-1' ) ) ) . toEqual ( pkg ) ;
337
336
} ) ;
338
337
339
338
it ( 'should load pkg and put null without package' , ( ) => {
@@ -342,9 +341,8 @@ describe('LicensePlugin', () => {
342
341
plugin . scanDependency ( id ) ;
343
342
344
343
expect ( plugin . _dependencies ) . toEqual ( { } ) ;
345
- expect ( plugin . _cache ) . toEqual ( {
346
- [ path . normalize ( path . join ( __dirname , '..' , 'src' ) ) ] : null ,
347
- } ) ;
344
+ expect ( plugin . _cache . size ) . toBe ( 1 ) ;
345
+ expect ( plugin . _cache . get ( path . normalize ( path . join ( __dirname , '..' , 'src' ) ) ) ) . toBeNull ( ) ;
348
346
} ) ;
349
347
350
348
it ( 'should try to load pkg without leading NULL character ' , ( ) => {
@@ -359,19 +357,18 @@ describe('LicensePlugin', () => {
359
357
'fake-package' : fakePackage ,
360
358
} ) ;
361
359
362
- expect ( plugin . _cache ) . toEqual ( {
363
- [ path . join ( __dirname , 'fixtures' , 'fake-package-1' , 'src' ) ] : pkg ,
364
- [ path . join ( __dirname , 'fixtures' , 'fake-package-1' ) ] : pkg ,
365
- } ) ;
360
+ expect ( plugin . _cache . size ) . toBe ( 2 ) ;
361
+ expect ( plugin . _cache . get ( path . join ( __dirname , 'fixtures' , 'fake-package-1' , 'src' ) ) ) . toEqual ( pkg ) ;
362
+ expect ( plugin . _cache . get ( path . join ( __dirname , 'fixtures' , 'fake-package-1' ) ) ) . toEqual ( pkg ) ;
366
363
} ) ;
367
364
368
365
it ( 'should load pkg and use the cache if available' , ( ) => {
369
366
const existsSync = spyOn ( fs , 'existsSync' ) . and . callThrough ( ) ;
370
367
const pkgPath = path . join ( __dirname , 'fixtures' , 'fake-package-1' ) ;
371
368
const id = path . join ( pkgPath , 'src' , 'index.js' ) ;
372
369
373
- plugin . _cache [ path . join ( pkgPath , 'src' ) ] = null ;
374
- plugin . _cache [ pkgPath ] = null ;
370
+ plugin . _cache . set ( path . join ( pkgPath , 'src' ) , null ) ;
371
+ plugin . _cache . set ( pkgPath , null ) ;
375
372
376
373
plugin . scanDependency ( id ) ;
377
374
0 commit comments