Skip to content

Commit

Permalink
fix(stepfunctions): Actually perform rendering of NotCondition
Browse files Browse the repository at this point in the history
Without this fix, the `Not` condition would render as (notice that `variable`, `comparisonOperator` and `value` are not capitalized):
```
{ Not:
   VariableComparison { variable: '$.a', comparisonOperator: 0, value: 'b' } }
```
  • Loading branch information
spg authored and RomainMuller committed Mar 18, 2019
1 parent 3790858 commit 06b59d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-stepfunctions/lib/condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class NotCondition extends Condition {

public renderCondition(): any {
return {
Not: this.comparisonOperation
Not: this.comparisonOperation.renderCondition()
};
}
}
}
14 changes: 13 additions & 1 deletion packages/@aws-cdk/aws-stepfunctions/test/test.condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,17 @@ export = {
});

test.done();
}
},
'NotConditon must render properly'(test: Test) {
// GIVEN
const condition = stepfunctions.Condition.not(stepfunctions.Condition.stringEquals('$.a', 'b'));

// WHEN
const render = condition.renderCondition();

// THEN
test.deepEqual(render, {Not: {Variable: '$.a', StringEquals: 'b'}});

test.done();
},
};

0 comments on commit 06b59d9

Please sign in to comment.