зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635542 - Fix name of messaging experiment in ActionsManager r=k88hudson
Differential Revision: https://phabricator.services.mozilla.com/D73934
This commit is contained in:
Родитель
da5b77f74b
Коммит
d7e4393107
|
@ -32,18 +32,6 @@ var EXPORTED_SYMBOLS = ["ActionsManager"];
|
|||
|
||||
const log = LogManager.getLogger("recipe-runner");
|
||||
|
||||
const actionConstructors = {
|
||||
"addon-rollback": AddonRollbackAction,
|
||||
"addon-rollout": AddonRolloutAction,
|
||||
"branched-addon-study": BranchedAddonStudyAction,
|
||||
"console-log": ConsoleLogAction,
|
||||
"messsaging-experiment": MessagingExperimentAction,
|
||||
"multi-preference-experiment": PreferenceExperimentAction,
|
||||
"preference-rollback": PreferenceRollbackAction,
|
||||
"preference-rollout": PreferenceRolloutAction,
|
||||
"show-heartbeat": ShowHeartbeatAction,
|
||||
};
|
||||
|
||||
/**
|
||||
* A class to manage the actions that recipes can use in Normandy.
|
||||
*/
|
||||
|
@ -52,15 +40,29 @@ class ActionsManager {
|
|||
this.finalized = false;
|
||||
|
||||
this.localActions = {};
|
||||
for (const [name, Constructor] of Object.entries(actionConstructors)) {
|
||||
for (const [name, Constructor] of Object.entries(
|
||||
ActionsManager.actionConstructors
|
||||
)) {
|
||||
this.localActions[name] = new Constructor();
|
||||
}
|
||||
}
|
||||
|
||||
static actionConstructors = {
|
||||
"addon-rollback": AddonRollbackAction,
|
||||
"addon-rollout": AddonRolloutAction,
|
||||
"branched-addon-study": BranchedAddonStudyAction,
|
||||
"console-log": ConsoleLogAction,
|
||||
"messaging-experiment": MessagingExperimentAction,
|
||||
"multi-preference-experiment": PreferenceExperimentAction,
|
||||
"preference-rollback": PreferenceRollbackAction,
|
||||
"preference-rollout": PreferenceRolloutAction,
|
||||
"show-heartbeat": ShowHeartbeatAction,
|
||||
};
|
||||
|
||||
static getCapabilities() {
|
||||
// Prefix each action name with "action." to turn it into a capability name.
|
||||
let capabilities = new Set();
|
||||
for (const actionName of Object.keys(actionConstructors)) {
|
||||
for (const actionName of Object.keys(ActionsManager.actionConstructors)) {
|
||||
capabilities.add(`action.${actionName}`);
|
||||
}
|
||||
return capabilities;
|
||||
|
|
|
@ -4,6 +4,9 @@ ChromeUtils.import("resource://normandy/actions/BaseAction.jsm", this);
|
|||
ChromeUtils.import("resource://normandy/lib/ActionsManager.jsm", this);
|
||||
ChromeUtils.import("resource://normandy/lib/NormandyApi.jsm", this);
|
||||
ChromeUtils.import("resource://normandy/lib/Uptake.jsm", this);
|
||||
const { ActionSchemas } = ChromeUtils.import(
|
||||
"resource://normandy/actions/schemas/index.js"
|
||||
);
|
||||
|
||||
// Test life cycle methods for actions
|
||||
decorate_task(async function(reportActionStub, Stub) {
|
||||
|
@ -45,3 +48,16 @@ decorate_task(async function(reportActionStub, Stub) {
|
|||
"finalize should be called on the unused action"
|
||||
);
|
||||
});
|
||||
|
||||
decorate_task(async function() {
|
||||
for (const [name, Constructor] of Object.entries(
|
||||
ActionsManager.actionConstructors
|
||||
)) {
|
||||
const action = new Constructor();
|
||||
Assert.deepEqual(
|
||||
ActionSchemas[name],
|
||||
action.schema,
|
||||
"action name should map to a schema"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче