@@ -874,17 +874,21 @@ test('kitchen sink', async () => {
874
874
fsx . cleanup ( )
875
875
} )
876
876
877
- test ( 'rename file' , async ( ) => {
877
+ test . only ( 'rename file' , async ( ) => {
878
878
const files = {
879
879
a : {
880
880
url : './rename/a.js' ,
881
881
content : `export default ''`
882
+ } ,
883
+ b : {
884
+ url : './rename/b.js' ,
885
+ content : `export default ''`
882
886
}
883
887
}
884
888
885
889
const fsx = fixtures . create ( files )
886
890
const w = graph ( { cwd : fixtures . getRoot ( ) } )
887
- await w . add ( [ fsx . files . a ] )
891
+ await w . add ( [ fsx . files . a , fsx . files . b ] )
888
892
889
893
w . on ( 'error' , e => {
890
894
console . log ( e )
@@ -893,10 +897,10 @@ test('rename file', async () => {
893
897
await wait ( DELAY )
894
898
895
899
const noChangeEvent = subscribe ( 'change' , w )
896
- const newFileName = path . join ( fsx . root , '/rename/b .js' )
900
+ const newFileName = path . join ( fsx . root , '/rename/c .js' )
897
901
898
902
// rename
899
- fs . moveSync ( fsx . files . a , newFileName )
903
+ fs . moveSync ( fsx . files . b , newFileName )
900
904
901
905
// change it
902
906
fs . outputFileSync ( newFileName , `export default ''` , 'utf8' )
@@ -910,7 +914,9 @@ test('rename file', async () => {
910
914
}
911
915
912
916
// renamed file was removed
913
- assert ( w . tree [ fsx . files . a ] === undefined )
917
+ assert ( w . tree [ fsx . files . b ] === undefined )
918
+ assert ( w . ids [ 0 ] === fsx . files . a )
919
+ assert ( w . ids [ 1 ] === undefined )
914
920
915
921
// add renamed file
916
922
await w . add ( [ newFileName ] )
0 commit comments