From 06b59d9bbbfb9fcc3df7bc8cdcc71aaf7834aac0 Mon Sep 17 00:00:00 2001 From: Simon-Pierre Gingras Date: Mon, 18 Mar 2019 01:25:34 -0700 Subject: [PATCH] fix(stepfunctions): Actually perform rendering of NotCondition 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' } } ``` --- .../@aws-cdk/aws-stepfunctions/lib/condition.ts | 4 ++-- .../aws-stepfunctions/test/test.condition.ts | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/condition.ts b/packages/@aws-cdk/aws-stepfunctions/lib/condition.ts index d7b1d80dad20a..5125960302cce 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/condition.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/condition.ts @@ -221,7 +221,7 @@ class NotCondition extends Condition { public renderCondition(): any { return { - Not: this.comparisonOperation + Not: this.comparisonOperation.renderCondition() }; } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-stepfunctions/test/test.condition.ts b/packages/@aws-cdk/aws-stepfunctions/test/test.condition.ts index f0577272715b8..118504b910f74 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/test.condition.ts +++ b/packages/@aws-cdk/aws-stepfunctions/test/test.condition.ts @@ -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(); + }, };