let initPromise = Normandy.init({ runAsync: false });
// note: There are no awaits before these asserts, so only the part of // Normandy's initialization before its first await can run. Assert.equal(
Services.prefs.getCharPref(experimentPref, "default"), "experiment"
); Assert.equal(Services.prefs.getCharPref(rolloutPref, "default"), "rollout");
await initPromise;
await Normandy.uninit();
}
);
// Normandy's initialization function should register the observer for UI // startup before it's first await.
decorate_task(
NormandyTestUtils.withStub(Normandy, "finishInit"),
NormandyTestUtils.withStub(NormandyMigrations, "applyAll"),
async function test_normandy_init_applies_startup_prefs_synchronously({
applyAllStub,
}) {
let originalDeferred = Normandy.uiAvailableNotificationObserved;
let mockUiAvailableDeferred = Promise.withResolvers();
Normandy.uiAvailableNotificationObserved = mockUiAvailableDeferred;
let applyAllDeferred = Promise.withResolvers();
applyAllStub.returns(applyAllStub);
let promiseResolvedCount = 0;
mockUiAvailableDeferred.promise.then(() => promiseResolvedCount++);
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.