test_bookmark_batch_fail.js (786B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 _("Making sure a failing sync reports a useful error"); 5 // `Service` is used as a global in head_helpers.js. 6 // eslint-disable-next-line no-unused-vars 7 const { Service } = ChromeUtils.importESModule( 8 "resource://services-sync/service.sys.mjs" 9 ); 10 11 add_bookmark_test(async function run_test(engine) { 12 await engine.initialize(); 13 engine._syncStartup = async function () { 14 throw new Error("FAIL!"); 15 }; 16 17 try { 18 _("Try calling the sync that should throw right away"); 19 await engine._sync(); 20 do_throw("Should have failed sync!"); 21 } catch (ex) { 22 _("Making sure what we threw ended up as the exception:", ex); 23 Assert.equal(ex.message, "FAIL!"); 24 } 25 });