How to use gherkin-ast - 10 common examples

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 / RemoveDuplicates.spec.js View on Github external
it('should not display anything if verbose turned off even if duplicate row found', () => {
                const compiler = new RemoveDuplicates({
                    processRows: true,
                    verbose: false
                });
                const examples = new Examples();
                const row = new TableRow();
                row.cells.push(new TableCell('hello'));
                row.cells.push(new TableCell('world'));
                examples.body.push(row);
                examples.body.push(row.clone());
                compiler._filterRows(examples, {}, {});

                expect(console.log.called, 'console.log is called').to.be.false;
                expect(console.warn.called, 'console.warn is called').to.be.false;
            })
        });
github gherking / gherking / test / builtIn / RemoveDuplicates.spec.js View on Github external
it('should not display anything if verbose turned off even if duplicate row found', () => {
                const compiler = new RemoveDuplicates({
                    processRows: true,
                    verbose: false
                });
                const examples = new Examples();
                const row = new TableRow();
                row.cells.push(new TableCell('hello'));
                row.cells.push(new TableCell('world'));
                examples.body.push(row);
                examples.body.push(row.clone());
                compiler._filterRows(examples, {}, {});

                expect(console.log.called, 'console.log is called').to.be.false;
                expect(console.warn.called, 'console.warn is called').to.be.false;
            })
        });
github gherking / gherking / test / builtIn / RemoveDuplicates.spec.js View on Github external
it('should not display anything if verbose turned off even if duplicate row found', () => {
                const compiler = new RemoveDuplicates({
                    processRows: true,
                    verbose: false
                });
                const examples = new Examples();
                const row = new TableRow();
                row.cells.push(new TableCell('hello'));
                row.cells.push(new TableCell('world'));
                examples.body.push(row);
                examples.body.push(row.clone());
                compiler._filterRows(examples, {}, {});

                expect(console.log.called, 'console.log is called').to.be.false;
                expect(console.warn.called, 'console.warn is called').to.be.false;
            })
        });
github gherking / gherking / test / builtIn / RemoveDuplicates.spec.js View on Github external
it('should remove tag if presents on parent', () => {
            const compiler = new RemoveDuplicates();
            const element = {tags: [new Tag('@onFeature')]};
            const parent = {tags: [new Tag('@onFeature')]};

            compiler._filterTags(element, parent);
            expect(element.tags).to.have.length(0);
            expect(parent.tags).to.have.length(1);
        });
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 / ForLoop.spec.js View on Github external
it('should return the correct iterator', () => {
            const loop = new ForLoop();
            const scenario = new Scenario('Scenario', 'Scenario name');
            const tag = new Tag('@loop(4)');
            scenario.tags.push(tag);

            expect(loop.getIterationNumber(scenario)).to.eql(4);
        });
    });
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 not filter out non macro scenarios', () => {
        const scenario = new Scenario();
        const tag = new Tag('@notmacro');

        scenario.tags.push(tag);
        expect(macro.preFilterScenario(scenario)).to.be.undefined;
    });
github gherking / gherking / test / builtIn / RemoveDuplicates.spec.js View on Github external
it('should not remove unique tags', () => {
            const compiler = new RemoveDuplicates();
            const element = {tags: [new Tag('@duplicate'), new Tag('@notDuplicate')]};
            const parent = {tags: []};

            compiler._filterTags(element, parent);
            expect(element.tags).to.have.length(2);
            expect(element.tags[0].name).to.equal('@duplicate');
            expect(element.tags[1].name).to.equal('@notDuplicate');
        });
github gherking / gherking / test / builtIn / RemoveDuplicates.spec.js View on Github external
it('should not remove unique tag if not present on parent', () => {
            const compiler = new RemoveDuplicates();
            const element = {tags: [new Tag('@onScenario')]};
            const parent = {tags: [new Tag('@onFeature')]};

            compiler._filterTags(element, parent);
            expect(element.tags).to.have.length(1);
            expect(element.tags[0].name).to.equal('@onScenario');
        });

gherkin-ast

JS model for Gherkin feature files

MIT
Latest version published 3 months ago

Package Health Score

73 / 100
Full package analysis