Skip to content

Commit

Permalink
Use closure actions for tests (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner authored Aug 19, 2019
1 parent 7440418 commit 4c787b2
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 69 deletions.
9 changes: 7 additions & 2 deletions tests/helpers/test-scenarios.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
PromiseArray
} = DS;

export function testScenarios(description, scenarios, template, testFn, preRenderTestFn) {
export function testScenarios(description, scenarios, template, testFn, preRenderTestFn, setValuesBeforeRender) {
for (const scenarioName in scenarios) {
const scenario = scenarios[scenarioName];

Expand All @@ -21,11 +21,16 @@ export function testScenarios(description, scenarios, template, testFn, preRende
this.set(key, value);
}

// An extra function to set values before render. Mostly to set the closure actions
if (setValuesBeforeRender) {
await setValuesBeforeRender.call(this, assert);
}

await this.render(template);

if (preRenderTestFn) {
await preRenderTestFn.call(this, assert);
} else {
} else if(testFn) {
await wait();
await testFn.call(this, assert);
}
Expand Down
Loading

0 comments on commit 4c787b2

Please sign in to comment.