Skip to content

Commit

Permalink
fix filerjs#637: added tests for fs.fsync()
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia Yatsenko authored and Julia Yatsenko committed Dec 19, 2018
1 parent fe7d902 commit cef05cf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/spec/fs.fsync.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ describe('fs.fsync', function() {

it('should return error when fd is not a number', function(done) {
var fs = util.fs();
fs.fsync('1', function(error) {
fs.fsync('notAnInteger', function(error) {
expect(error).to.exist;
expect(error.code).to.equal('EINVAL');
done();
});
});

it('should return error when fd is invalid', function(done) {
var fs = util.fs();
fs.fsync(1, function(error) {
it('should return an error if file descriptor is negative', function(done) {
let fs = util.fs();

// File descriptor should be a non-negative number
fs.fsync(-1, function(error) {
expect(error).to.exist;
expect(error.code).to.equal('EBADF');
done();
Expand Down

0 comments on commit cef05cf

Please sign in to comment.