1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 09:53:00 +01:00

Merge pull request #14 from adobe/new-raw-file-tests

Added tests for trying to read/write a directory using the read/writeFile APIs
This commit is contained in:
Glenn Ruehle 2011-12-15 15:40:07 -08:00
commit 71379b18cf

View File

@ -130,6 +130,12 @@ describe("LowLevelFileIO", function() {
expect(err).toBe(brackets.fs.ERR_INVALID_PARAMS);
});
});
it ("should return an error if trying to read a directory", function() {
brackets.fs.readFile(baseDir, "utf8", function(err, contents) {
expect(err).toBe(brackets.fs.ERR_CANT_READ);
});
})
}); // describe("readFile")
describe("writeFile", function() {
@ -157,5 +163,12 @@ describe("LowLevelFileIO", function() {
expect(err).toBe(brackets.fs.ERR_INVALID_PARAMS);
});
});
it ("should return an error if trying to write a directory", function() {
brackets.fs.writeFile(baseDir, contents, "utf8", function(err, contents) {
// Ideally we would get ERR_CANT_WRITE, but as long as we get some sort of error it's fine.
expect(err).toBeTruthy();
});
})
}); // describe("writeFile")
});