Fix #431: add test for fsPromises.unlink

add newline at end

implemented suggestions

formatting fixes
This commit is contained in:
jagmeetb 2018-09-21 20:35:22 -04:00 committed by David Humphrey
parent d1dd5fef61
commit 1abcb0369b
1 changed files with 16 additions and 0 deletions

View File

@ -123,4 +123,20 @@ describe('fs.promises.unlink', function () {
expect(error.code).to.equal('ENOENT');
});
});
it('should not unlink directories', () => {
var fs = util.fs().promises;
return fs.mkdir('/mydir')
.then(() => fs.unlink('/mydir'))
.catch(error => {
expect(error).to.exist;
expect(error.code).to.equal('EPERM');
})
.then(() => fs.stat('/mydir'))
.then(stats => {
expect(stats).to.exist;
expect(stats.type).to.equal('DIRECTORY');
});
});
});