Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from Oct 16, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/spec/fs.read.spec.js
Expand Up @@ -87,4 +87,18 @@ 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also deal with the specific error code. In Filer that would (currently) be 'EBADF'. In note that in node, it would be: Error: ENXIO: no such device or address, read errno: -6, code: 'ENXIO'. This would require a fix to our implementation if we want to match 100% (not sure it's that important).

expect(result).not.to.exist;
done();
});
});
});