Issue #158 - Added test to ensure that watchers monitoring hardlinks are notified when the original file is updated

This commit is contained in:
kwkofler 2014-04-17 15:02:15 -04:00 committed by David Humphrey
parent 7d196763f8
commit 97fb82769a
1 changed files with 29 additions and 0 deletions

View File

@ -73,6 +73,35 @@ describe('fs.watch', function() {
if(error) throw error; if(error) throw error;
}); });
}); });
it('should get a change event when a file hardlink is being watched and the original file is changed', function(done) {
var fs = util.fs();
fs.writeFile('/myfile', 'data', function(error) {
if(error) throw error;
fs.link('/myfile', '/hardlink', function(error) {
if(error) throw error;
var watcher = fs.watch('/hardlink', function(event, filename) {
expect(event).to.equal('change');
expect(filename).to.equal('/hardlink');
watcher.close();
done();
});
fs.appendFile('/myfile', '...more data', function(error) {
if(error) throw error;
fs.readFile('/hardlink', 'utf8', function(error, data) {
if(error) throw error;
expect(data).to.equal('data...more data')
});
});
});
});
});
}); });
it('should get a change event when renaming a file', function(done) { it('should get a change event when renaming a file', function(done) {