From 4a5d8c1222cb454040b28397896bbf667ba6b2fe Mon Sep 17 00:00:00 2001 From: Dan Lin Date: Mon, 24 Sep 2018 16:46:47 -0400 Subject: [PATCH] Fix #456 - add test for fs.write() with undefined path --- tests/spec/fs.write.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/spec/fs.write.spec.js b/tests/spec/fs.write.spec.js index 63658ec..8a9cab2 100644 --- a/tests/spec/fs.write.spec.js +++ b/tests/spec/fs.write.spec.js @@ -4,6 +4,18 @@ var expect = require('chai').expect; describe('fs.write', function() { beforeEach(util.setup); afterEach(util.cleanup); + + // if the file is undefined, it will create problems + // + it('should be a error',function(done){ + var fs=util.fs(); + fs.writeFile(undefined, 'data', function(error) { + expect(error).to.exist; + expect(error.code).to.equal('EINVAL'); + done(); + }); + }); + it('should be a function', function() { var fs = util.fs();