Skip to content

Commit

Permalink
Merge branch 'main' into upgrade-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelien-reeves authored Jul 20, 2021
2 parents 405663a + dd62cbb commit b8afade
Show file tree
Hide file tree
Showing 7 changed files with 373 additions and 317 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
"mustache": "4.2.0",
"nyc": "15.1.0",
"prettier": "2.3.2",
"reindent-template-literals": "^1.0.0",
"semver": "7.3.5",
"sinon": "11.1.1",
"sinon-chai": "3.7.0",
Expand Down
111 changes: 60 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 { reindent } from 'reindent-template-literals'

describe('GherkinDocumentParser', () => {
describe('getGherkinStepMap', () => {
Expand Down Expand Up @@ -315,64 +316,72 @@ 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(
reindent(`
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(
reindent(`
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(
reindent(`
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(
reindent(`
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

0 comments on commit b8afade

Please sign in to comment.