How to use the gherkin-ast.Step function in gherkin-ast

To help you get started, we’ve selected a few gherkin-ast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should throw an error when there is no macro by name provided', () => {
        const step = new Step('And', 'macro test2 is executed');
        expect(() => macro.onStep(step)).to.throw(Error)
    });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should throw an error when a macro name is already defined', () => {
        const scenario = new Scenario();
        const scenario_2 = new Scenario();
        const tag = new Tag('@macro(testname)');
        const step = new Step('Given', 'step');

        scenario.tags.push(tag);
        scenario_2.tags.push(tag);
        scenario.steps.push(step);

        macro.macros.testname = scenario;

        expect(() => macro.preFilterScenario(scenario_2)).to.throw(Error);
    });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should process macro steps', () => {
        const scenario_macro = new Scenario();
        const tag = new Tag('@macro(test)');
        const step_macro = new Step('When', 'test step');
        const step_test = new Step('And', 'macro test is executed');

        scenario_macro.tags.push(tag);
        scenario_macro.steps.push(step_macro);

        macro.preFilterScenario(scenario_macro);
        expect(macro.onStep(step_test)).to.eql(scenario_macro.steps);
    });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should throw an error when a macro contains a macro step', () => {
        const scenario = new Scenario();
        const tag = new Tag('@macro(test)');
        const step = new Step('And', 'macro test is executed');

        scenario.tags.push(tag);
        scenario.steps.push(step);
        expect(() => macro.preFilterScenario(scenario)).to.throw(Error)
    });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should not change non macro steps', () => {
        const step = new Step('Given', 'random step');
        expect(macro.onStep(step)).to.eql(undefined);
    });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should throw an error when name is not provided for macro', () => {
        const step = new Step('And', 'macro is executed');
        expect(() => {
            macro.onStep(step);
        }).to.throw(Error)
    });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should process macro steps', () => {
        const scenario_macro = new Scenario();
        const tag = new Tag('@macro(test)');
        const step_macro = new Step('When', 'test step');
        const step_test = new Step('And', 'macro test is executed');

        scenario_macro.tags.push(tag);
        scenario_macro.steps.push(step_macro);

        macro.preFilterScenario(scenario_macro);
        expect(macro.onStep(step_test)).to.eql(scenario_macro.steps);
    });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should process macro scenarios', () => {
        const scenario = new Scenario();
        const tag = new Tag('@macro(test_tag)');
        const step = new Step('Given', 'random step');

        scenario.tags.push(tag);
        scenario.steps.push(step);

        macro.preFilterScenario(scenario);

        expect(macro.macros.test_tag.steps).to.be.eql(scenario.steps);
    });
github gherking / gherking / lib / builtIn / Macro.js View on Github external
static createStep(macro) {
        return new Step('When', `macro ${macro} is executed`);
    }
}

gherkin-ast

JS model for Gherkin feature files

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis