| 1 | class DataScenarioConfig { |
| 2 | constructor(scenarios) { |
| 3 | this.scenarios = scenarios |
| 4 | } |
| 5 | |
| 6 | /** |
| 7 | * Declares that test throws error. |
| 8 | * Can pass an Error object or regex matching expected message. |
| 9 | * |
| 10 | * @param {*} err |
| 11 | */ |
| 12 | throws(err) { |
| 13 | this.scenarios.forEach(scenario => scenario.throws(err)) |
| 14 | return this |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Declares that test should fail. |
| 19 | * If test passes - throws an error. |
| 20 | * Can pass an Error object or regex matching expected message. |
| 21 | * |
| 22 | */ |
| 23 | fails() { |
| 24 | this.scenarios.forEach(scenario => scenario.fails()) |
| 25 | return this |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Retry this test for x times |
| 30 | * |
| 31 | * @param {*} retries |
| 32 | */ |
| 33 | retry(retries) { |
| 34 | this.scenarios.forEach(scenario => scenario.retry(retries)) |
| 35 | return this |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Set timeout for this test |
| 40 | * @param {*} timeout |
| 41 | */ |
| 42 | timeout(timeout) { |
| 43 | this.scenarios.forEach(scenario => scenario.timeout(timeout)) |
| 44 | return this |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Configures a helper. |
| 49 | * Helper name can be omitted and values will be applied to first helper. |
| 50 | */ |
| 51 | config(helper, obj) { |
| 52 | this.scenarios.forEach(scenario => scenario.config(helper, obj)) |
| 53 | return this |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Append a tag name to scenario title |
| 58 | * @param {*} tagName |
| 59 | */ |
| 60 | tag(tagName) { |
nothing calls this directly
no outgoing calls
no test coverage detected