Skip to content

Commit

Permalink
Bug 1548770 - Better test for File.createFile(), r=smaug
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D30612

--HG--
extra : moz-landing-system : lando
  • Loading branch information
bakulf committed May 10, 2019
1 parent d293ec5 commit e927104
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions dom/file/tests/test_createFile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
async function run_test() {
add_task(async function() {
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

do_get_profile();
Expand Down Expand Up @@ -28,4 +28,13 @@ async function run_test() {

let b = await File.createFromNsIFile(unknownFile, { existenceCheck: false });
ok(b.size == 0, "The size is 0 for unknown file");
}

let c = await File.createFromNsIFile(existingFile, { existenceCheck: true });
ok(c.size != 0, "The size is correctly set");

let d = await File.createFromNsIFile(unknownFile, { existenceCheck: true }).then(_ => true, _ => false);
ok(d === false, "Exception thrown");

existingFile.remove(true);
ok(!existingFile.exists(), "exists.js doesn't exist anymore");
});

0 comments on commit e927104

Please sign in to comment.