Skip to content

Commit

Permalink
add test for deprecated parameters field
Browse files Browse the repository at this point in the history
  • Loading branch information
beck3905 committed Feb 28, 2023
1 parent 49d2f0c commit 8a0704d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface MapProps {
*
* @default $
* @deprecated Step Functions has deprecated the `parameters` field in favor of
* the new `itemSelector` field.
* the new `itemSelector` field
* @see
* https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemselector.html
*/
Expand Down
48 changes: 47 additions & 1 deletion packages/@aws-cdk/aws-stepfunctions/test/map.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { testDeprecated } from '@aws-cdk/cdk-build-tools';
import * as cdk from '@aws-cdk/core';
import * as stepfunctions from '../lib';

describe('Map State', () => {
test('State Machine With Map State', () => {
test('State Machine With Map State and ItemSelector', () => {
// GIVEN
const stack = new cdk.Stack();

Expand Down Expand Up @@ -47,6 +48,51 @@ describe('Map State', () => {
});
}),

testDeprecated('State Machine With Map State and Parameters', () => {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const map = new stepfunctions.Map(stack, 'Map State', {
maxConcurrency: 1,
itemsPath: stepfunctions.JsonPath.stringAt('$.inputForMap'),
parameters: {
foo: 'foo',
bar: stepfunctions.JsonPath.stringAt('$.bar'),
},
});
map.iterator(new stepfunctions.Pass(stack, 'Pass State'));

// THEN
expect(render(map)).toStrictEqual({
StartAt: 'Map State',
States: {
'Map State': {
Type: 'Map',
End: true,
Parameters: {
'foo': 'foo',
'bar.$': '$.bar',
},
ItemProcessor: {
ProcessorConfig: {
Mode: stepfunctions.MapStateMode.INLINE,
},
StartAt: 'Pass State',
States: {
'Pass State': {
Type: 'Pass',
End: true,
},
},
},
ItemsPath: '$.inputForMap',
MaxConcurrency: 1,
},
},
});
}),

test('State Machine With Map State and ResultSelector', () => {
// GIVEN
const stack = new cdk.Stack();
Expand Down

0 comments on commit 8a0704d

Please sign in to comment.