Skip to content

Commit

Permalink
Fix filerjs#411: Tests if event is thrown when calling rename
Browse files Browse the repository at this point in the history
  • Loading branch information
AHKol committed Sep 24, 2018
1 parent fd3de6b commit e0159a4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/spec/fs.watch.spec.js
Expand Up @@ -64,4 +64,25 @@ describe('fs.watch', function() {
});
});
});

it('should get a change event when renaming a file', function(done) {
var fs = util.fs();

//event should not be thrown
fs.writeFile('/myfile', 'data', function(error) {
if(error) throw error;
})

var watcher = fs.watch('/myfile', function(event, filename) {
expect(event).to.equal('change');
expect(filename).to.equal('/myfile');
watcher.close();
done();
});

//event should be thrown
fs.rename('/myfile', '/mynewfile', function(error) {
if(error) throw error;
});
});
});

0 comments on commit e0159a4

Please sign in to comment.