forked from mozilla/normandy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mozilla#43 from Osmose/fix-recipe-execution
Do not use an XRay-ed Promise during recipe execution.
- Loading branch information
Showing
3 changed files
with
71 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
[browser_NormandyApi.js] | ||
support-files = | ||
test_server.sjs | ||
[browser_RecipeRunner.js] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use strict"; | ||
|
||
const {utils: Cu} = Components; | ||
Cu.import("resource://shield-recipe-client/lib/RecipeRunner.jsm", this); | ||
|
||
add_task(function*() { | ||
// Test that RecipeRunner can execute a basic recipe/action. | ||
const recipe = { | ||
foo: "bar", | ||
}; | ||
const actionScript = ` | ||
class TestAction { | ||
constructor(driver, recipe) { | ||
this.recipe = recipe; | ||
} | ||
execute() { | ||
return new Promise(resolve => { | ||
resolve(this.recipe.foo); | ||
}); | ||
} | ||
} | ||
registerAction('test-action', TestAction); | ||
`; | ||
|
||
const result = yield RecipeRunner.executeAction(recipe, {}, actionScript); | ||
is(result, "bar", "Recipe executed correctly"); | ||
}); |