How to use the gherkin-ast.Scenario 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 / ForLoop.spec.js View on Github external
it('should throw an error when provided iterator exceeds maximum', () => {
            const loop = new ForLoop();
            const scenario = new Scenario('Scenario', 'Scenario name');
            const tag = new Tag('@loop(42)');
            scenario.tags.push(tag);

            expect(() => loop.getIterationNumber(scenario)).to.throw(Error);
        });
github gherking / gherking / test / builtIn / Macro.spec.js View on Github external
it('should throw an error when a macro does not contain any steps', () => {
        const scenario = new Scenario();
        const tag = new Tag('@macro(test)');

        scenario.tags.push(tag);
        expect(() => macro.preFilterScenario(scenario)).to.throw(Error)
    });
github gherking / gherking / test / builtIn / ForLoop.spec.js View on Github external
it('should process scenario names', () => {
            const loop = new ForLoop();
            const scenario = new Scenario('Scenario', 'Scenario name');
            loop.getIterationNumber = sinon.stub().returns(3);
            const result = loop.looper(scenario);

            result.forEach((scenario, i) => {
                expect(scenario.name).to.eql('Scenario name (' + (i + 1) + ')');
            })
        });
    });
github gherking / gherking / test / builtIn / ForLoop.spec.js View on Github external
it('should repeat scenarios for the correct times', () => {
            const loop = new ForLoop();
            const scenario = new Scenario('Scenario', 'Scenario name');
            loop.getIterationNumber = sinon.stub().returns(3);
            const result = loop.looper(scenario);

            expect(result).to.have.lengthOf(3);
            expect(loop.getIterationNumber.calledWith(scenario)).to.be.true;
        });
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 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 / ForLoop.spec.js View on Github external
it('should return 0 when there is no loop tag', () => {
            const loop = new ForLoop();
            const scenario = new Scenario('Scenario', 'Scenario name');

            expect(loop.getIterationNumber(scenario)).to.eql(0);
        });
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);
    });

gherkin-ast

JS model for Gherkin feature files

MIT
Latest version published 10 months ago

Package Health Score

67 / 100
Full package analysis