mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1465385 - Enable ESLint rule require-expected-throws-or-rejects for browser/. r=MattN
MozReview-Commit-ID: GoVFNM7CFDu --HG-- extra : rebase_source : f1e9bfdaa1396b2ce27ee499fc547f239ca132a9
This commit is contained in:
parent
ea0d874fa8
commit
7b90b63d69
@ -52,9 +52,6 @@ module.exports = {
|
||||
// XXX Bug 1452706. These directories are still being fixed, so turn off
|
||||
// mozilla/require-expected-throws-or-rejects for now.
|
||||
"files": [
|
||||
"browser/extensions/formautofill/test/unit/test_storage_tombstones.js",
|
||||
"browser/modules/test/browser/**",
|
||||
"browser/tools/mozscreenshots/browser_boundingbox.js",
|
||||
"devtools/client/inspector/extensions/test/head_devtools_inspector_sidebar.js",
|
||||
"storage/test/unit/**",
|
||||
"testing/marionette/test/unit/**",
|
||||
|
@ -121,18 +121,21 @@ add_storage_task(async function test_add_tombstone(storage, record) {
|
||||
|
||||
add_storage_task(async function test_add_tombstone_without_guid(storage, record) {
|
||||
info("Should not be able to add a new tombstone without specifying the guid");
|
||||
Assert.throws(() => { storage.add({deleted: true}); });
|
||||
Assert.throws(() => { storage.add({deleted: true}); },
|
||||
/Record missing GUID/);
|
||||
Assert.equal(storage.getAll({includeDeleted: true}).length, 0);
|
||||
});
|
||||
|
||||
add_storage_task(async function test_add_tombstone_existing_guid(storage, record) {
|
||||
info("Should not be able to add a new tombstone when a record with that ID exists");
|
||||
let guid = storage.add(record);
|
||||
Assert.throws(() => { storage.add({guid, deleted: true}); });
|
||||
Assert.throws(() => { storage.add({guid, deleted: true}); },
|
||||
/a record with this GUID already exists/);
|
||||
|
||||
// same if the existing item is already a tombstone.
|
||||
storage.add({guid: "test-guid-1", deleted: true});
|
||||
Assert.throws(() => { storage.add({guid: "test-guid-1", deleted: true}); });
|
||||
Assert.throws(() => { storage.add({guid: "test-guid-1", deleted: true}); },
|
||||
/a record with this GUID already exists/);
|
||||
});
|
||||
|
||||
add_storage_task(async function test_update_tombstone(storage, record) {
|
||||
|
@ -15,7 +15,7 @@ add_task(async function testTempAllowThrows() {
|
||||
await BrowserTestUtils.withNewTab(uri.spec, function(browser) {
|
||||
Assert.throws(function() {
|
||||
SitePermissions.set(uri, id, SitePermissions.ALLOW, SitePermissions.SCOPE_TEMPORARY, browser);
|
||||
}, "'Block' is the only permission we can save temporarily on a tab");
|
||||
}, /'Block' is the only permission we can save temporarily on a browser/);
|
||||
});
|
||||
});
|
||||
|
||||
@ -91,4 +91,3 @@ add_task(async function testGetAllPermissionDetailsForBrowser() {
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
|
@ -562,8 +562,8 @@ add_task(async function test_shutdown_while_not_showing() {
|
||||
UnsubmittedCrashHandler.uninit();
|
||||
Assert.throws(() => {
|
||||
UnsubmittedCrashHandler.prefs.getBoolPref("shutdownWhileShowing");
|
||||
}, "We should have noticed that the notification had closed before " +
|
||||
"uninitting.");
|
||||
}, /NS_ERROR_UNEXPECTED/,
|
||||
"We should have noticed that the notification had closed before uninitting.");
|
||||
UnsubmittedCrashHandler.init();
|
||||
|
||||
clearPendingCrashReports();
|
||||
|
@ -93,10 +93,10 @@ add_task(async function() {
|
||||
// Check that nonexistent selectors throws an exception
|
||||
Assert.throws(() => {
|
||||
TestRunner._findBoundingBox(["#does_not_exist"]);
|
||||
}, "No element for '#does_not_exist' found.", "Checking that nonexistent selectors throws an exception");
|
||||
}, /No element for '#does_not_exist' found/, "Checking that nonexistent selectors throws an exception");
|
||||
|
||||
// Check that no selectors throws an exception
|
||||
Assert.throws(() => {
|
||||
TestRunner._findBoundingBox([]);
|
||||
}, "No selectors specified.", "Checking that no selectors throws an exception");
|
||||
}, /No selectors specified/, "Checking that no selectors throws an exception");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user