fix #637: added tests for fs.fsync()
This commit is contained in:
parent
fe7d902a2c
commit
cef05cf805
|
@ -12,16 +12,18 @@ describe('fs.fsync', function() {
|
||||||
|
|
||||||
it('should return error when fd is not a number', function(done) {
|
it('should return error when fd is not a number', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
fs.fsync('1', function(error) {
|
fs.fsync('notAnInteger', function(error) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
expect(error.code).to.equal('EINVAL');
|
expect(error.code).to.equal('EINVAL');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return error when fd is invalid', function(done) {
|
it('should return an error if file descriptor is negative', function(done) {
|
||||||
var fs = util.fs();
|
let fs = util.fs();
|
||||||
fs.fsync(1, function(error) {
|
|
||||||
|
// File descriptor should be a non-negative number
|
||||||
|
fs.fsync(-1, function(error) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
expect(error.code).to.equal('EBADF');
|
expect(error.code).to.equal('EBADF');
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in New Issue