@@ -12,6 +12,7 @@ import {
12
12
} from '../../../test/gherkin_helpers'
13
13
import * as messages from '@cucumber/messages'
14
14
import IGherkinDocument = messages . GherkinDocument
15
+ import { reindent } from 'reindent-template-literals'
15
16
16
17
describe ( 'GherkinDocumentParser' , ( ) => {
17
18
describe ( 'getGherkinStepMap' , ( ) => {
@@ -315,64 +316,72 @@ async function parseGherkinDocument(data: string): Promise<IGherkinDocument> {
315
316
}
316
317
317
318
async function withBackgroundAndScenario ( ) : Promise < IGherkinDocument > {
318
- return await parseGherkinDocument ( `\
319
- Feature: a feature
320
- Background:
321
- Given a setup step
322
-
323
- Scenario:
324
- When a regular step
325
- ` )
319
+ return await parseGherkinDocument (
320
+ reindent ( `
321
+ Feature: a feature
322
+ Background:
323
+ Given a setup step
324
+
325
+ Scenario:
326
+ When a regular step
327
+ ` )
328
+ )
326
329
}
327
330
328
331
async function withBackgroundAndScenarioOutline ( ) : Promise < IGherkinDocument > {
329
- return await parseGherkinDocument ( `\
330
- Feature: a feature
331
- Background:
332
- Given a setup step
333
-
334
- Scenario Outline:
335
- When a templated step with <word>
336
- Examples:
337
- | word |
338
- | foo |
339
- | bar |
340
- ` )
332
+ return await parseGherkinDocument (
333
+ reindent ( `
334
+ Feature: a feature
335
+ Background:
336
+ Given a setup step
337
+
338
+ Scenario Outline:
339
+ When a templated step with <word>
340
+ Examples:
341
+ | word |
342
+ | foo |
343
+ | bar |
344
+ ` )
345
+ )
341
346
}
342
347
343
348
async function withBackgroundAndRuleWithExamples ( ) : Promise < IGherkinDocument > {
344
- return await parseGherkinDocument ( `\
345
- Feature: a feature
346
- Background:
347
- Given a setup step
348
-
349
- Rule: a rule
350
- Example: an example
351
- When a regular step
352
- Then an assertion
353
-
354
- Example: another example
355
- When a regular step
356
- Then an assertion
357
- ` )
349
+ return await parseGherkinDocument (
350
+ reindent ( `
351
+ Feature: a feature
352
+ Background:
353
+ Given a setup step
354
+
355
+ Rule: a rule
356
+ Example: an example
357
+ When a regular step
358
+ Then an assertion
359
+
360
+ Example: another example
361
+ When a regular step
362
+ Then an assertion
363
+ ` )
364
+ )
358
365
}
359
366
360
367
async function withBackgroundAndRuleWithBackgroundAndExamples ( ) : Promise < IGherkinDocument > {
361
- return await parseGherkinDocument ( `\
362
- Feature: a feature
363
- Background:
364
- Given a feature-level setup step
365
-
366
- Rule: a rule
367
- Background:
368
- Given a rule-level setup step
369
-
370
- Example: an example
371
- When a regular step
372
- Then an assertion
373
-
374
- Example: another example
375
- When a regular step
376
- Then an assertion
377
- ` )
368
+ return await parseGherkinDocument (
369
+ reindent ( `
370
+ Feature: a feature
371
+ Background:
372
+ Given a feature-level setup step
373
+
374
+ Rule: a rule
375
+ Background:
376
+ Given a rule-level setup step
377
+
378
+ Example: an example
379
+ When a regular step
380
+ Then an assertion
381
+
382
+ Example: another example
383
+ When a regular step
384
+ Then an assertion
385
+ ` )
386
+ )
378
387
}
0 commit comments