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:
parent
73f0f19bb9
commit
1eab5f0ffd
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue