Merge branch 'develop' of github.com:js-platform/filer into develop
This commit is contained in:
commit
15a3174956
|
@ -607,6 +607,8 @@ function open_file(context, path, flags, callback) {
|
||||||
function read_directory_data(error, result) {
|
function read_directory_data(error, result) {
|
||||||
if(error) {
|
if(error) {
|
||||||
callback(error);
|
callback(error);
|
||||||
|
} else if(result.mode !== MODE_DIRECTORY) {
|
||||||
|
callback(new Errors.ENOENT());
|
||||||
} else {
|
} else {
|
||||||
directoryNode = result;
|
directoryNode = result;
|
||||||
context.get(directoryNode.data, check_if_file_exists);
|
context.get(directoryNode.data, check_if_file_exists);
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
var Filer = require('../..');
|
||||||
|
var util = require('../lib/test-utils.js');
|
||||||
|
var expect = require('chai').expect;
|
||||||
|
|
||||||
|
describe('fs.writeFile and non-existing directory, issue 239', function() {
|
||||||
|
beforeEach(util.setup);
|
||||||
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
|
it('should give ENOENT if writing to a dir that does not exist', function(done) {
|
||||||
|
var fs = util.fs();
|
||||||
|
|
||||||
|
fs.writeFile('/abc.txt', 'content', function(err) {
|
||||||
|
expect(err).not.to.exist;
|
||||||
|
|
||||||
|
fs.writeFile('/abc.txt/abc.txt', 'content', function(err) {
|
||||||
|
expect(err.code).to.equal('ENOENT');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -67,3 +67,4 @@ require("./spec/node-js/simple/test-fs-watch-recursive");
|
||||||
// NOTE: bugs/issue225.js has to be run outside this step, see gruntfile.js
|
// NOTE: bugs/issue225.js has to be run outside this step, see gruntfile.js
|
||||||
require("./bugs/issue105");
|
require("./bugs/issue105");
|
||||||
require("./bugs/issue106");
|
require("./bugs/issue106");
|
||||||
|
require("./bugs/issue239");
|
||||||
|
|
Loading…
Reference in New Issue