Failing test for #267, readdir on file path should error

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-08-20 15:44:12 -04:00
parent e01e422fe9
commit 4bba2512b0
2 changed files with 23 additions and 0 deletions

22
tests/bugs/issue267.js Normal file
View File

@ -0,0 +1,22 @@
var Filer = require('../..');
var util = require('../lib/test-utils.js');
var expect = require('chai').expect;
describe('fs.readdir on non-dir paths, issue 267', function() {
beforeEach(util.setup);
afterEach(util.cleanup);
it('should fail with ENOTDIR when called on filepath', function(done) {
var fs = util.fs();
fs.writeFile('/myfile.txt', 'data', function(err) {
if(err) throw err;
fs.readdir('/myfile.txt', function(err, contents) {
expect(err).to.exist;
expect(err.code).to.equal('ENOTDIR');
done();
});
});
});
});

View File

@ -73,3 +73,4 @@ require("./bugs/ls-depth-bug");
require("./bugs/issue247.js"); require("./bugs/issue247.js");
require("./bugs/issue254.js"); require("./bugs/issue254.js");
require("./bugs/issue258.js"); require("./bugs/issue258.js");
require("./bugs/issue267.js");