filer/tests/bugs/issue267.js

23 lines
598 B
JavaScript
Raw Permalink Normal View History

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;
done();
});
});
});
});