Skip to content

Commit

Permalink
fix(basic): Complex array for array definition should be allowed.
Browse files Browse the repository at this point in the history
Fixes #9
  • Loading branch information
bruno-morel committed Jun 23, 2020
1 parent c5d51ec commit 9b72e39
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/specs/features/basic-scenarios.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ Feature: Rocket Launching
Then the rocket should end up in space
And the booster(s) should land back on the launch pad
But nobody should doubt me ever again

Scenario: Folding ourselves in 2D
Given I am Elon Musk attempting to launch a rocket into space
And my position in 2D space is [ 0, 2 ]
When I launch the rocket
Then the rocket should end up in space
7 changes: 7 additions & 0 deletions test/specs/features/step-definitions/basic-scenarios.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ Then( 'the rocket should end up in space', () => {
expect(rocket.isInSpace).toBe(true)
} )

/// Complex Regex : at position (\[(?: *\d+(?: |, |,)*)+\]) with no value
And( /^my position in 2D space is (\[(?: *\d+(?: |, |,)*)+\])$/, function( arrayPosition ) {

const isAnArray = JSON.parse( arrayPosition )
expect( isAnArray ).toBeInstanceOf( Array )
} )

And( /^the booster\(s\) should land back on the launch pad$/, () => {
expect(rocket.boostersLanded).toBe(true)
} )
Expand Down

0 comments on commit 9b72e39

Please sign in to comment.