Add test for fs.writeFile-readFile.spec to write a file in non-existing path (#486)

This commit is contained in:
giantpanpan 2018-10-09 13:48:51 -04:00 committed by David Humphrey
parent 3e0da99040
commit beea03dbae
1 changed files with 13 additions and 0 deletions

View File

@ -22,6 +22,19 @@ describe('fs.writeFile, fs.readFile', function() {
}); });
}); });
it('should error when path is wrong to writeFile',function(done){
var fs = util.fs();
fs.writeFile('/tmp/myfile', '','utf8', function(error, result) {
expect(error).to.exist;
expect(error.code).to.equal('ENOENT');
expect(result).not.to.exist;
done();
});
});
it('should write, read a utf8 file without specifying utf8 in writeFile', function(done) { it('should write, read a utf8 file without specifying utf8 in writeFile', function(done) {
var fs = util.fs(); var fs = util.fs();
var contents = 'This is a file.'; var contents = 'This is a file.';