Fix #411: Tests if event is thrown when calling rename (#478)

* Fix #411: Tests if event is thrown when calling rename

* npm run lint:fix

* Added comment explaining lack of 'rename' event check
This commit is contained in:
AHKol 2018-10-15 16:33:47 -04:00 committed by David Humphrey
parent 41510e7da4
commit 8aa8dda4d6
1 changed files with 21 additions and 0 deletions

View File

@ -64,4 +64,25 @@ describe('fs.watch', function() {
}); });
}); });
}); });
it('should get a change event when renaming a file', function(done) {
var fs = util.fs();
fs.writeFile('/myfile', 'data', function(error) {
if(error) throw error;
});
//Normaly A 'rename' event should be thrown, but filer doesn't support that event at this time.
//For now renaming a file will throw a change event.
var watcher = fs.watch('/myfile', function(event, filename) {
expect(event).to.equal('change');
expect(filename).to.equal('/myfile');
watcher.close();
done();
});
fs.rename('/myfile', '/mynewfile', function(error) {
if(error) throw error;
});
});
}); });