From cef05cf805f819a920038a5d6efa081c54e8a091 Mon Sep 17 00:00:00 2001 From: Julia Yatsenko Date: Wed, 19 Dec 2018 18:49:05 -0500 Subject: [PATCH] fix #637: added tests for fs.fsync() --- tests/spec/fs.fsync.spec.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/spec/fs.fsync.spec.js b/tests/spec/fs.fsync.spec.js index 6c21877..ce68f02 100644 --- a/tests/spec/fs.fsync.spec.js +++ b/tests/spec/fs.fsync.spec.js @@ -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();