Issue #158 - Added test to ensure that watchers monitoring hardlinks are notified when the original file is updated
This commit is contained in:
parent
7d196763f8
commit
97fb82769a
|
@ -73,6 +73,35 @@ describe('fs.watch', function() {
|
|||
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) {
|
||||
|
|
Loading…
Reference in New Issue