Skip to content

Commit

Permalink
Fix#461 - Added test for fs.read when attempting to read a file that …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
CometS1 authored and humphd committed Oct 16, 2018
1 parent 73f0f19 commit 1eab5f0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/spec/fs.read.spec.js
Expand Up @@ -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() {
Expand Down

0 comments on commit 1eab5f0

Please sign in to comment.