Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 52 additions & 51 deletions src/formatter/helpers/gherkin_document_parser_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '../../../test/gherkin_helpers'
import * as messages from '@cucumber/messages'
import IGherkinDocument = messages.GherkinDocument
import { unindent } from '../../../test/formatter_helpers'

describe('GherkinDocumentParser', () => {
describe('getGherkinStepMap', () => {
Expand Down Expand Up @@ -315,64 +316,64 @@ async function parseGherkinDocument(data: string): Promise<IGherkinDocument> {
}

async function withBackgroundAndScenario(): Promise<IGherkinDocument> {
return await parseGherkinDocument(`\
Feature: a feature
Background:
Given a setup step

Scenario:
When a regular step
`)
return await parseGherkinDocument(unindent`
Feature: a feature
Background:
Given a setup step

Scenario:
When a regular step
`)
}

async function withBackgroundAndScenarioOutline(): Promise<IGherkinDocument> {
return await parseGherkinDocument(`\
Feature: a feature
Background:
Given a setup step

Scenario Outline:
When a templated step with <word>
Examples:
| word |
| foo |
| bar |
`)
return await parseGherkinDocument(unindent`
Feature: a feature
Background:
Given a setup step

Scenario Outline:
When a templated step with <word>
Examples:
| word |
| foo |
| bar |
`)
}

async function withBackgroundAndRuleWithExamples(): Promise<IGherkinDocument> {
return await parseGherkinDocument(`\
Feature: a feature
Background:
Given a setup step

Rule: a rule
Example: an example
When a regular step
Then an assertion
Example: another example
When a regular step
Then an assertion
`)
return await parseGherkinDocument(unindent`
Feature: a feature
Background:
Given a setup step

Rule: a rule
Example: an example
When a regular step
Then an assertion

Example: another example
When a regular step
Then an assertion
`)
}

async function withBackgroundAndRuleWithBackgroundAndExamples(): Promise<IGherkinDocument> {
return await parseGherkinDocument(`\
Feature: a feature
Background:
Given a feature-level setup step

Rule: a rule
Background:
Given a rule-level setup step
Example: an example
When a regular step
Then an assertion
Example: another example
When a regular step
Then an assertion
`)
return await parseGherkinDocument(unindent`
Feature: a feature
Background:
Given a feature-level setup step

Rule: a rule
Background:
Given a rule-level setup step

Example: an example
When a regular step
Then an assertion

Example: another example
When a regular step
Then an assertion
`)
}
Loading