@@ -43,6 +43,7 @@ describe('Map State', () => {
43
43
} ,
44
44
} ) ;
45
45
} ) ,
46
+
46
47
test ( 'State Machine With Map State and ResultSelector' , ( ) => {
47
48
// GIVEN
48
49
const stack = new cdk . Stack ( ) ;
@@ -84,6 +85,7 @@ describe('Map State', () => {
84
85
} ,
85
86
} ) ;
86
87
} ) ,
88
+
87
89
test ( 'synth is successful' , ( ) => {
88
90
const app = createAppWithMap ( ( stack ) => {
89
91
const map = new stepfunctions . Map ( stack , 'Map State' , {
@@ -96,6 +98,7 @@ describe('Map State', () => {
96
98
97
99
app . synth ( ) ;
98
100
} ) ,
101
+
99
102
test ( 'fails in synthesis if iterator is missing' , ( ) => {
100
103
const app = createAppWithMap ( ( stack ) => {
101
104
const map = new stepfunctions . Map ( stack , 'Map State' , {
@@ -108,6 +111,7 @@ describe('Map State', () => {
108
111
109
112
expect ( ( ) => app . synth ( ) ) . toThrow ( / M a p s t a t e m u s t h a v e a n o n - e m p t y i t e r a t o r / ) ;
110
113
} ) ,
114
+
111
115
test ( 'fails in synthesis when maxConcurrency is a float' , ( ) => {
112
116
const app = createAppWithMap ( ( stack ) => {
113
117
const map = new stepfunctions . Map ( stack , 'Map State' , {
@@ -121,6 +125,7 @@ describe('Map State', () => {
121
125
122
126
expect ( ( ) => app . synth ( ) ) . toThrow ( / m a x C o n c u r r e n c y h a s t o b e a p o s i t i v e i n t e g e r / ) ;
123
127
} ) ,
128
+
124
129
test ( 'fails in synthesis when maxConcurrency is a negative integer' , ( ) => {
125
130
const app = createAppWithMap ( ( stack ) => {
126
131
const map = new stepfunctions . Map ( stack , 'Map State' , {
@@ -134,6 +139,7 @@ describe('Map State', () => {
134
139
135
140
expect ( ( ) => app . synth ( ) ) . toThrow ( / m a x C o n c u r r e n c y h a s t o b e a p o s i t i v e i n t e g e r / ) ;
136
141
} ) ,
142
+
137
143
test ( 'fails in synthesis when maxConcurrency is too big to be an integer' , ( ) => {
138
144
const app = createAppWithMap ( ( stack ) => {
139
145
const map = new stepfunctions . Map ( stack , 'Map State' , {
@@ -147,22 +153,42 @@ describe('Map State', () => {
147
153
148
154
expect ( ( ) => app . synth ( ) ) . toThrow ( / m a x C o n c u r r e n c y h a s t o b e a p o s i t i v e i n t e g e r / ) ;
149
155
} ) ,
156
+
157
+ test ( 'does not fail synthesis when maxConcurrency is a jsonPath' , ( ) => {
158
+ const app = createAppWithMap ( ( stack ) => {
159
+ const map = new stepfunctions . Map ( stack , 'Map State' , {
160
+ maxConcurrency : stepfunctions . JsonPath . numberAt ( '$.maxConcurrency' ) ,
161
+ itemsPath : stepfunctions . JsonPath . stringAt ( '$.inputForMap' ) ,
162
+ } ) ;
163
+ map . iterator ( new stepfunctions . Pass ( stack , 'Pass State' ) ) ;
164
+
165
+ return map ;
166
+ } ) ;
167
+
168
+ expect ( ( ) => app . synth ( ) ) . not . toThrow ( ) ;
169
+ } ) ;
170
+
150
171
test ( 'isPositiveInteger is false with negative number' , ( ) => {
151
172
expect ( stepfunctions . isPositiveInteger ( - 1 ) ) . toEqual ( false ) ;
152
173
} ) ,
174
+
153
175
test ( 'isPositiveInteger is false with decimal number' , ( ) => {
154
176
expect ( stepfunctions . isPositiveInteger ( 1.2 ) ) . toEqual ( false ) ;
155
177
} ) ,
178
+
156
179
test ( 'isPositiveInteger is false with a value greater than safe integer' , ( ) => {
157
180
const valueToTest = Number . MAX_SAFE_INTEGER + 1 ;
158
181
expect ( stepfunctions . isPositiveInteger ( valueToTest ) ) . toEqual ( false ) ;
159
182
} ) ,
183
+
160
184
test ( 'isPositiveInteger is true with 0' , ( ) => {
161
185
expect ( stepfunctions . isPositiveInteger ( 0 ) ) . toEqual ( true ) ;
162
186
} ) ,
187
+
163
188
test ( 'isPositiveInteger is true with 10' , ( ) => {
164
189
expect ( stepfunctions . isPositiveInteger ( 10 ) ) . toEqual ( true ) ;
165
190
} ) ,
191
+
166
192
test ( 'isPositiveInteger is true with max integer value' , ( ) => {
167
193
expect ( stepfunctions . isPositiveInteger ( Number . MAX_SAFE_INTEGER ) ) . toEqual ( true ) ;
168
194
} ) ;
0 commit comments