@@ -785,20 +785,17 @@ describe('Unit: Commands > Update', function () {
785
785
} ) ;
786
786
787
787
describe ( 'removeOldVersions' , function ( ) {
788
- it ( 'skips if there are 5 or fewer versions installed' , async function ( ) {
788
+ it ( 'skips if there are 2 or fewer versions installed' , async function ( ) {
789
789
const dirs = [
790
- 'versions/1.4.0' ,
791
- 'versions/1.5.0' ,
792
790
'versions/1.5.1' ,
793
791
'versions/1.5.2'
794
792
] ;
795
793
const env = setupTestFolder ( { dirs : dirs } ) ;
796
794
const UpdateCommand = require ( modulePath ) ;
797
795
const instance = new UpdateCommand ( { } , { } ) ;
798
- sinon . stub ( process , 'cwd' ) . returns ( env . dir ) ;
799
796
const skipStub = sinon . stub ( ) ;
800
797
801
- await instance . removeOldVersions ( { } , { skip : skipStub } ) ;
798
+ await instance . removeOldVersions ( { instance : { dir : env . dir } } , { skip : skipStub } ) ;
802
799
expect ( skipStub . calledOnce ) . to . be . true ;
803
800
804
801
dirs . forEach ( ( version ) => {
@@ -825,20 +822,20 @@ describe('Unit: Commands > Update', function () {
825
822
const instance = new UpdateCommand ( { } , { } ) ;
826
823
sinon . stub ( process , 'cwd' ) . returns ( env . dir ) ;
827
824
const keptVersions = [
828
- '1.1.0' ,
829
- '1.2.0' ,
830
- '1.3.0' ,
831
825
'1.4.0' ,
832
826
'1.5.0'
833
827
] ;
834
828
const removedVersions = [
835
829
'1.0.0-beta.2' ,
836
830
'1.0.0-RC.1' ,
837
831
'1.0.0' ,
838
- '1.0.2'
832
+ '1.0.2' ,
833
+ '1.1.0' ,
834
+ '1.2.0' ,
835
+ '1.3.0'
839
836
] ;
840
837
841
- await instance . removeOldVersions ( ) ;
838
+ await instance . removeOldVersions ( { instance : { dir : env . dir } } ) ;
842
839
keptVersions . forEach ( ( version ) => {
843
840
expect ( fs . existsSync ( path . join ( env . dir , 'versions' , version ) ) ) . to . be . true ;
844
841
} ) ;
0 commit comments