Fix#461 - Added test for fs.read when attempting to read a file that does not exist (#472)

* Added test for fs.read when attempting to read a file that does not exist

* Added test for fs.read when attempting to read a file that does not exist

* Modified read test for non-existent file to act more similar to earlier tests

* Added check in read test for error code
This commit is contained in:
Shawn Pang 2018-10-16 11:22:54 -04:00 committed by David Humphrey
parent 73f0f19bb9
commit 1eab5f0ffd
1 changed files with 15 additions and 0 deletions

View File

@ -87,6 +87,21 @@ describe('fs.read', function() {
}); });
}); });
}); });
it('should fail to read a file that does not exist', function(done) {
var fs = util.fs();
var fd = 0;
var rbuffer = new Filer.Buffer(8);
rbuffer.fill(0);
fs.read(fd, rbuffer, 0, rbuffer.length, 0, function(error, result) {
expect(error).to.exist;
expect(result).not.to.exist;
expect(error.code).to.equal('EBADF');
done();
});
});
}); });
describe('fs.promises.read', function() { describe('fs.promises.read', function() {