From 2992f7417bc3e179a8f5ffaac278b66e79d01a0b Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Wed, 16 Jul 2014 15:23:11 -0400 Subject: [PATCH] Failing test for issue #239 --- tests/bugs/issue239.js | 21 +++++++++++++++++++++ tests/index.js | 1 + 2 files changed, 22 insertions(+) create mode 100644 tests/bugs/issue239.js diff --git a/tests/bugs/issue239.js b/tests/bugs/issue239.js new file mode 100644 index 0000000..8e70f1a --- /dev/null +++ b/tests/bugs/issue239.js @@ -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(); + }); + }); + }); +}); diff --git a/tests/index.js b/tests/index.js index 0fb467a..b427ee3 100644 --- a/tests/index.js +++ b/tests/index.js @@ -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 require("./bugs/issue105"); require("./bugs/issue106"); +require("./bugs/issue239");