@@ -367,16 +367,63 @@ describe('State', function() {
367367 } ) ;
368368
369369 describe ( '#resetState' , function ( ) {
370- it ( 'should call call rm on the platforms path ' , function ( ) {
370+ it ( 'should call call rm on the platforms ands plugins paths by default ' , function ( ) {
371371 spyOn ( shelljs , 'rm' ) ;
372372 spyOn ( State , 'restoreState' ) . andReturn ( Q ( ) ) ;
373373 State . resetState ( tempDirectory , { } ) ;
374374
375375 var platformPath = path . join ( tempDirectory , 'platforms' ) ;
376376 var pluginPath = path . join ( tempDirectory , 'plugins' ) ;
377- expect ( shelljs . rm ) . toHaveBeenCalledWith ( '-rf' , [ platformPath , pluginPath ] ) ;
377+ expect ( shelljs . rm ) . toHaveBeenCalledWith ( '-rf' , [ platformPath ] ) ;
378+ expect ( shelljs . rm ) . toHaveBeenCalledWith ( '-rf' , [ pluginPath ] ) ;
378379 expect ( State . restoreState ) . toHaveBeenCalledWith ( tempDirectory , { } ) ;
379380 } ) ;
381+
382+ it ( 'should call call rm on the platforms ands plugins path if both passed' , function ( ) {
383+ spyOn ( shelljs , 'rm' ) ;
384+ spyOn ( State , 'restoreState' ) . andReturn ( Q ( ) ) ;
385+ State . resetState ( tempDirectory , {
386+ platforms : true ,
387+ plugins : true
388+ } ) ;
389+
390+ var platformPath = path . join ( tempDirectory , 'platforms' ) ;
391+ var pluginPath = path . join ( tempDirectory , 'plugins' ) ;
392+ expect ( shelljs . rm ) . toHaveBeenCalledWith ( '-rf' , [ platformPath ] ) ;
393+ expect ( shelljs . rm ) . toHaveBeenCalledWith ( '-rf' , [ pluginPath ] ) ;
394+ expect ( State . restoreState ) . toHaveBeenCalledWith ( tempDirectory , {
395+ platforms : true ,
396+ plugins : true
397+ } ) ;
398+ } ) ;
399+
400+ it ( 'should call call rm only on the platforms path if passed explicitly' , function ( ) {
401+ spyOn ( shelljs , 'rm' ) ;
402+ spyOn ( State , 'restoreState' ) . andReturn ( Q ( ) ) ;
403+ State . resetState ( tempDirectory , {
404+ platforms : true
405+ } ) ;
406+
407+ var platformPath = path . join ( tempDirectory , 'platforms' ) ;
408+ expect ( shelljs . rm ) . toHaveBeenCalledWith ( '-rf' , [ platformPath ] ) ;
409+ expect ( State . restoreState ) . toHaveBeenCalledWith ( tempDirectory , {
410+ platforms : true
411+ } ) ;
412+ } ) ;
413+
414+ it ( 'should call call rm only on the plugins path if passed explicitly' , function ( ) {
415+ spyOn ( shelljs , 'rm' ) ;
416+ spyOn ( State , 'restoreState' ) . andReturn ( Q ( ) ) ;
417+ State . resetState ( tempDirectory , {
418+ plugins : true
419+ } ) ;
420+
421+ var pluginPath = path . join ( tempDirectory , 'plugins' ) ;
422+ expect ( shelljs . rm ) . toHaveBeenCalledWith ( '-rf' , [ pluginPath ] ) ;
423+ expect ( State . restoreState ) . toHaveBeenCalledWith ( tempDirectory , {
424+ plugins : true
425+ } ) ;
426+ } ) ;
380427 } ) ;
381428
382429 describe ( '#restorePlugins' , function ( ) {
0 commit comments