Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
ChromeUtils.defineESModuleGetters(this, {
});
const PREF_SYSTEM_SHORTCUTS_PERSONALIZATION =
"discoverystream.shortcuts.personalization.enabled";
add_task(async function test_construction() {
let feed = new SmartShortcutsFeed();
feed.store = {
getState() {
return this.state;
},
state: {
Prefs: {
values: {
[PREF_SYSTEM_SHORTCUTS_PERSONALIZATION]: false,
},
},
},
};
info("SmartShortcutsFeed constructor should create initial values");
Assert.ok(feed, "Could construct a SmartShortcutsFeed");
Assert.ok(!feed.loaded, "SmartShortcutsFeed is not loaded");
Assert.ok(!feed.isEnabled());
});
add_task(async function test_onAction_INIT() {
let feed = new SmartShortcutsFeed();
feed.store = {
getState() {
return this.state;
},
state: {
Prefs: {
values: {
[PREF_SYSTEM_SHORTCUTS_PERSONALIZATION]: true,
},
},
},
};
info("SmartShortcutsFeed.onAction INIT should set loaded");
await feed.onAction({
type: actionTypes.INIT,
});
Assert.ok(feed.loaded);
});
add_task(async function test_isEnabled() {
let feed = new SmartShortcutsFeed();
feed.store = {
getState() {
return this.state;
},
state: {
Prefs: {
values: {
[PREF_SYSTEM_SHORTCUTS_PERSONALIZATION]: true,
},
},
},
};
info("SmartShortcutsFeed should be enabled");
Assert.ok(feed.isEnabled());
});