Skip to content

Commit 9b72e39

Browse files
author
bruno-morel
committed
fix(basic): Complex array for array definition should be allowed.
Fixes #9
1 parent c5d51ec commit 9b72e39

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

test/specs/features/basic-scenarios.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ Feature: Rocket Launching
2020
Then the rocket should end up in space
2121
And the booster(s) should land back on the launch pad
2222
But nobody should doubt me ever again
23+
24+
Scenario: Folding ourselves in 2D
25+
Given I am Elon Musk attempting to launch a rocket into space
26+
And my position in 2D space is [ 0, 2 ]
27+
When I launch the rocket
28+
Then the rocket should end up in space

test/specs/features/step-definitions/basic-scenarios.steps.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ Then( 'the rocket should end up in space', () => {
2626
expect(rocket.isInSpace).toBe(true)
2727
} )
2828

29+
/// Complex Regex : at position (\[(?: *\d+(?: |, |,)*)+\]) with no value
30+
And( /^my position in 2D space is (\[(?: *\d+(?: |, |,)*)+\])$/, function( arrayPosition ) {
31+
32+
const isAnArray = JSON.parse( arrayPosition )
33+
expect( isAnArray ).toBeInstanceOf( Array )
34+
} )
35+
2936
And( /^the booster\(s\) should land back on the launch pad$/, () => {
3037
expect(rocket.boostersLanded).toBe(true)
3138
} )

0 commit comments

Comments
 (0)