Bug 1933302 - Make sure last update of in-app notifications is initialized to a sensible value. r=arschmitz
And extend test to make sure initialization runs Differential Revision: https://phabricator.services.mozilla.com/D229994 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d5c2ac9b8e
Коммит
23b7ce1b2a
|
@ -167,6 +167,9 @@ export const InAppNotifications = {
|
|||
if (typeof data.seeds !== "object") {
|
||||
data.seeds = {};
|
||||
}
|
||||
if (!Number.isInteger(data.lastUpdate) || data.lastUpdate > Date.now()) {
|
||||
data.lastUpdate = 0;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
|
|
|
@ -79,6 +79,22 @@ add_task(function test_initializedData() {
|
|||
"Should register update callback"
|
||||
);
|
||||
Assert.ok(NotificationUpdater._interval, "Should initialize updater");
|
||||
|
||||
Assert.deepEqual(
|
||||
InAppNotifications._jsonFile.data.interactedWith,
|
||||
[],
|
||||
"Should initialize interacted with notifications"
|
||||
);
|
||||
Assert.deepEqual(
|
||||
InAppNotifications._jsonFile.data.seeds,
|
||||
{},
|
||||
"Should initialize seeds"
|
||||
);
|
||||
Assert.equal(
|
||||
InAppNotifications._jsonFile.data.lastUpdate,
|
||||
0,
|
||||
"Should initialize lastUpdate to 0"
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_noReinitialization() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче