Bug 1466497 - Enable ESLint rule require-expected-throws-or-rejects for storage/test/unit. r?mak
MozReview-Commit-ID: KZNpShBcfjJ
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -47,25 +47,16 @@ module.exports = {
],
"rules": {
"mozilla/no-define-cc-etc": "off",
}
}, {
// XXX Bug 1452706. These directories are still being fixed, so turn off
// mozilla/require-expected-throws-or-rejects for now.
"files": [
- "storage/test/unit/**",
- ],
- "rules": {
- "mozilla/require-expected-throws-or-rejects": "off",
- }
- }, {
- // XXX Bug 1452706. These directories are still being fixed, so turn off
- // mozilla/require-expected-throws-or-rejects for now.
- "files": [
"services/fxaccounts/**",
"toolkit/components/**",
],
"rules": {
"mozilla/rejects-requires-await": "off",
}
}]
};
--- a/storage/test/unit/test_js_helpers.js
+++ b/storage/test/unit/test_js_helpers.js
@@ -78,16 +78,17 @@ function test_row_enumerate() {
// Save off the row helper, then forget the statement and trigger a GC. We
// want to ensure that if the row helper is retained but the statement is
// destroyed, that no crash occurs and that the late access attempt simply
// throws an error.
let savedOffRow = stmt.row;
stmt = null;
Cu.forceGC();
Assert.throws(() => { return savedOffRow.string; },
+ /NS_ERROR_NOT_INITIALIZED/,
"GC'ed statement should throw");
}
function test_params_gets_sync() {
// Added for bug 562866.
/*
let stmt = createStatement(
"SELECT * FROM test WHERE id IN (:a, :b, :c)"
--- a/storage/test/unit/test_storage_connection.js
+++ b/storage/test/unit/test_storage_connection.js
@@ -820,17 +820,17 @@ add_task(async function test_async_clone
Assert.ok(names.includes("markh"));
info("Create read-only clone");
let readOnlyClone = await asyncClone(db, true);
Assert.ok(readOnlyClone instanceof Ci.mozIStorageAsyncConnection);
info("Read-only clone shouldn't have temp entities");
let badStmt = readOnlyClone.createAsyncStatement(`SELECT 1 FROM test_temp`);
- await Assert.rejects(executeAsync(badStmt));
+ await Assert.rejects(executeAsync(badStmt), Ci.mozIStorageError);
badStmt.finalize();
info("Clean up");
for (let conn of [db, readWriteClone, readOnlyClone]) {
await asyncClose(conn);
}
});