From c33f22b464e84b7fe6b1f3c193c81ff69fe95724 Mon Sep 17 00:00:00 2001 From: pynnl <31667324+pynnl@users.noreply.github.com> Date: Tue, 9 Oct 2018 17:40:35 -0400 Subject: [PATCH] Issue 396 - Add a test for fs.promises.stat() when the path does not exist (#406) * test non exist path for promise * fix new line at the end * fix missing semicolon 113:26 * follow 'Testing promise codes' on guidline --- tests/spec/fs.stat.spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/spec/fs.stat.spec.js b/tests/spec/fs.stat.spec.js index a2c9e4d..3a0cb61 100644 --- a/tests/spec/fs.stat.spec.js +++ b/tests/spec/fs.stat.spec.js @@ -121,3 +121,22 @@ describe('fs.stat', function() { }); }); }); + +/** + * fsPromises tests + */ + +describe('fsPromises.stat', function() { + beforeEach(util.setup); + afterEach(util.cleanup); + + it('should return an error if path does not exist', function() { + var fsPromises = util.fs().promises; + + return fsPromises.stat('/tmp') + .catch(error => { + expect(error).to.exist; + expect(error.code).to.equal('ENOENT'); + }); + }); +});