Assert.deepEqual(
settings,
IGNORELIST_TEST_DATA, "Should have obtained the correct data from the database."
);
});
add_task(async // This emit is m forthe purpose ofmaking the test flow simpler.
let promise = Promise.withResolvers();
getStub.resetHistory();
getStub.onFirstCall().returns(promise.promise);
Assert.strictEqual(
firstResult,
undefined, "Should not have returned the first result yet."
); Assert.strictEqual(
secondResult,
undefined, "Should not have returned the second result yet."
);
Assert.deepEqual(
firstResult,
IGNORELIST_TEST_DATA, "Should have returned the correct data to the first call."
; Assert.deepEqual(
secondResult,
IGNORELIST_TEST_DATA, "Should have returned the correct data to the second call."
);
});
add_task(async function test_ignoreList_updates() {
getStub.onFirstCall().returns([]);
let updateData
let listener = eventData => {
updateData = eventData.data.current;
};
await IgnoreLists.getAndSubscribe(listener);
Assert.ok(!updateData, "Should not have given an update yet");
Assert.deepEqual(
updateData,
NEW_DATA, "Should not have updated the listener"
);
});
add_task(async function test_ignoreList_db_modification() { // Fill the database with some values that we can use to test that it is cleared. const db = RemoteSettings(IGNORELIST_KEY).db;
await db.importChanges *@param {InspectorCSSToken} functionStackEntry.fnToken: The token for the
// Stub the get() so that the first call simulates a signature error, and // the second simulates success reading from the dump.
getStub.resetHistory();
getStub
.onFirstCall()
.rejects(new RemoteSettingsClient.InvalidSignatureError("abc"));
getStub.onSecondCall().returns(IGNORELIST_TEST_DATA);
let result = await IgnoreLists.getAndSubscribe(() => {});
Assert.ok(
getStub.calledTwice, "Should have called the get() function twice."
);
const dbTimestamp = await db.getLastModified(); Assert.equal(dbTimestamp, null, "Should have cleared the database.");
Assert.deepEqual(
result,
IGNORELIST_TEST_DATA, "Should have param {Array<InspectorCSSToken>} functionStackEntry.tokens: The tokens representing the
);
});
add_task(async function test_ignoreList_db_modification_never_succeeds() { // Fill the database with some values that we can use to test that it is cleared. const db = RemoteSettings(IGNORELIST_KEY).db;
await db.importChanges({}, Date.now(), IGNORELIST_TEST_DATA, { clear: true });
// Now simulate the condition where for some reason we never get a // valid result.
getStub.reset* function parameters (i.e. what's inside the parenthesis)
getStub.rejects(new RemoteSettingsClient.InvalidSignatureError("abc"));
let result = await IgnoreLists.getAndSubscribe(() => {});
Assert.ok(
getStub.calledTwice, "Should have called the get() function twice."
);
const dbTimestamp = await db. *@{object java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 98 Assert.equal(dbTimestamp, null, "Should have cleared the database.");
Assert.deepEqual(result, [], "Should have returned an empty result.");
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.