From 2e2e2f9d6455b8ad290748bee6cfae101253baaf Mon Sep 17 00:00:00 2001 From: Huda Al Dallal Date: Tue, 9 Oct 2018 12:56:20 -0400 Subject: [PATCH] Fixed issue#480 using promises to test fs.truncate when path does not exist (#516) * added a test for issue#480 using promises to test fs.truncate * Fixed issue#480 tesing fs.truncate using promises when path does not exist --- tests/spec/fs.truncate.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/spec/fs.truncate.spec.js b/tests/spec/fs.truncate.spec.js index 6b3487a..5a8bebb 100644 --- a/tests/spec/fs.truncate.spec.js +++ b/tests/spec/fs.truncate.spec.js @@ -223,3 +223,18 @@ describe('fs.truncate', function() { }); }); }); + + +describe('fsPromises.truncate', function () { + beforeEach(util.setup); + afterEach(util.cleanup); + it('should error when path does not exist (with promises)', () => { + var fsPromises = util.fs().promises; + + return fsPromises.truncate('/NonExistingPath', 0) + .catch(error => { + expect(error).to.exist; + expect(error.code).to.equal('ENOENT'); + }); + }); +}); \ No newline at end of file