2014-08-20 19:44:12 +00:00
|
|
|
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');
|
2018-07-27 15:08:40 +00:00
|
|
|
expect(contents).not.to.exist;
|
2014-08-20 19:44:12 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|