|
1 | 1 | import { DataTable, Given } from '@cucumber/cucumber'; |
2 | | -import { world } from "./world" |
3 | | -import { yaml } from "@letsflow/core" |
| 2 | +import { world } from './world'; |
| 3 | +import { yaml } from '@letsflow/core'; |
4 | 4 |
|
5 | 5 | async function addProcess(name: string, scenario: string) { |
6 | 6 | await world.addProcess(name, scenario); |
7 | 7 | } |
8 | 8 | Given('the {string} process is created from the {string} scenario', (name, scenario) => addProcess(name, scenario)); |
9 | 9 | Given('the process is created from the {string} scenario', (scenario) => addProcess('main', scenario)); |
10 | 10 |
|
11 | | -function addActor(name: string, actor = "actor", process = "main", propsTable?: string | DataTable) { |
| 11 | +function addActor(name: string, actor = 'actor', process = 'main', propsTable?: string | DataTable) { |
12 | 12 | const props = typeof propsTable === 'string' ? yaml.parse(propsTable) : propsTable?.rowsHash(); |
13 | 13 | world.addActor(process, name, actor, props); |
14 | 14 | } |
15 | 15 | Given('{string} is the {string} actor in the {string} process with:', addActor); |
16 | | -Given('{string} is the actor in the {string} process', (name, process) => addActor(name, "actor", process)); |
17 | | -Given('{string} is the actor in the {string} process with:', (name, process, propsTable) => addActor(name, process, "actor", propsTable)); |
18 | | -Given('{string} is the {string} actor in the {string} process', (name, actor, process) => addActor(name, actor, process)); |
19 | | -Given('{string} is the actor', (name) => addActor(name, "actor", "main")); |
20 | | -Given('{string} is the {string} actor', (name, actor) => addActor(name, actor, "main")); |
21 | | -Given('{string} is the actor with:', (name: string, propsTable: string | DataTable) => addActor(name, "main", "actor", propsTable)); |
22 | | -Given('{string} is the {string} actor with:', (name: string, actor: string, propsTable: string | DataTable) => addActor(name, actor, "main", propsTable)); |
| 16 | +Given('{string} is the actor in the {string} process', (name, process) => addActor(name, 'actor', process)); |
| 17 | +Given('{string} is the actor in the {string} process with:', (name, process, propsTable) => |
| 18 | + addActor(name, process, 'actor', propsTable), |
| 19 | +); |
| 20 | +Given('{string} is the {string} actor in the {string} process', (name, actor, process) => |
| 21 | + addActor(name, actor, process), |
| 22 | +); |
| 23 | +Given('{string} is the actor', (name) => addActor(name, 'actor', 'main')); |
| 24 | +Given('{string} is the {string} actor', (name, actor) => addActor(name, actor, 'main')); |
| 25 | +Given('{string} is the actor with:', (name: string, propsTable: string | DataTable) => |
| 26 | + addActor(name, 'main', 'actor', propsTable), |
| 27 | +); |
| 28 | +Given('{string} is the {string} actor with:', (name: string, actor: string, propsTable: string | DataTable) => |
| 29 | + addActor(name, actor, 'main', propsTable), |
| 30 | +); |
0 commit comments