Add test to confirm that fs.appendFile works when file is missing.

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-03-25 19:19:42 -04:00
parent fe4b1e5c0e
commit 1cbede711a
1 changed files with 15 additions and 1 deletions

View File

@ -110,6 +110,20 @@ define(["Filer", "util"], function(Filer, util) {
});
});
});
});
it('should work when file does not exist, and create the file', function(done) {
var fs = util.fs();
var contents = "This is a file.";
fs.appendFile('/newfile', contents, { encoding: 'utf8' }, function(error) {
expect(error).not.to.exist;
fs.readFile('/newfile', 'utf8', function(err, data) {
if(err) throw err;
expect(data).to.equal(contents);
done();
});
});
});
});
});