summaryrefslogtreecommitdiffstats
path: root/browser/components/newtab/test/unit/lib/DiscoveryStreamFeed.test.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--browser/components/newtab/test/unit/lib/DiscoveryStreamFeed.test.js30
1 files changed, 14 insertions, 16 deletions
diff --git a/browser/components/newtab/test/unit/lib/DiscoveryStreamFeed.test.js b/browser/components/newtab/test/unit/lib/DiscoveryStreamFeed.test.js
index 92e10facb3..e10a4cbc04 100644
--- a/browser/components/newtab/test/unit/lib/DiscoveryStreamFeed.test.js
+++ b/browser/components/newtab/test/unit/lib/DiscoveryStreamFeed.test.js
@@ -2,7 +2,7 @@ import {
actionCreators as ac,
actionTypes as at,
actionUtils as au,
-} from "common/Actions.sys.mjs";
+} from "common/Actions.mjs";
import { combineReducers, createStore } from "redux";
import { GlobalOverrider } from "test/unit/utils";
import { DiscoveryStreamFeed } from "lib/DiscoveryStreamFeed.sys.mjs";
@@ -849,6 +849,8 @@ describe("DiscoveryStreamFeed", () => {
spocs: { items: [{ id: "data" }] },
});
sandbox.stub(feed.cache, "set").returns(Promise.resolve());
+ const loadTimestamp = 100;
+ clock.tick(loadTimestamp);
await feed.loadSpocs(feed.store.dispatch);
@@ -860,15 +862,15 @@ describe("DiscoveryStreamFeed", () => {
title: "",
sponsor: "",
sponsored_by_override: undefined,
- items: [{ id: "data", score: 1 }],
+ items: [{ id: "data", score: 1, fetchTimestamp: loadTimestamp }],
},
},
- lastUpdated: 0,
+ lastUpdated: loadTimestamp,
});
assert.deepEqual(
feed.store.getState().DiscoveryStream.spocs.data.spocs.items[0],
- { id: "data", score: 1 }
+ { id: "data", score: 1, fetchTimestamp: loadTimestamp }
);
});
it("should normalizeSpocsItems for older spoc data", async () => {
@@ -882,7 +884,7 @@ describe("DiscoveryStreamFeed", () => {
assert.deepEqual(
feed.store.getState().DiscoveryStream.spocs.data.spocs.items[0],
- { id: "data", score: 1 }
+ { id: "data", score: 1, fetchTimestamp: 0 }
);
});
it("should dispatch DISCOVERY_STREAM_PERSONALIZATION_OVERRIDE with feature_flags", async () => {
@@ -936,7 +938,7 @@ describe("DiscoveryStreamFeed", () => {
context: "",
sponsor: "",
sponsored_by_override: undefined,
- items: [{ id: "data", score: 1 }],
+ items: [{ id: "data", score: 1, fetchTimestamp: 0 }],
},
placement2: {
title: "",
@@ -978,7 +980,7 @@ describe("DiscoveryStreamFeed", () => {
context: "context",
sponsor: "",
sponsored_by_override: undefined,
- items: [{ id: "data", score: 1 }],
+ items: [{ id: "data", score: 1, fetchTimestamp: 0 }],
},
});
});
@@ -3444,16 +3446,12 @@ describe("DiscoveryStreamFeed", () => {
},
});
sandbox.stub(global.Region, "home").get(() => "DE");
- globals.set("NimbusFeatures", {
- saveToPocket: {
- getVariable: sandbox.stub(),
- },
- });
- global.NimbusFeatures.saveToPocket.getVariable
- .withArgs("bffApi")
+ sandbox.stub(global.Services.prefs, "getStringPref");
+ global.Services.prefs.getStringPref
+ .withArgs("extensions.pocket.bffApi")
.returns("bffApi");
- global.NimbusFeatures.saveToPocket.getVariable
- .withArgs("oAuthConsumerKeyBff")
+ global.Services.prefs.getStringPref
+ .withArgs("extensions.pocket.oAuthConsumerKeyBff")
.returns("oAuthConsumerKeyBff");
});
it("should return true with isBff", async () => {