0.0.21 • Published 2 years ago

@wheatstalk/cdk-assert-state v0.0.21

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

AWS CDK Assert State

This construct lib provides AssertState, a Step Functions State Machine state that uses expect-like assertions to check input.

import { App, Stack } from 'aws-cdk-lib';
import { Chain, Pass, StateMachine } from 'aws-cdk-lib/aws-stepfunctions';
import { Assert, AssertState, Expr } from '@wheatstalk/cdk-assert-state';

const app = new App();
const stack = new Stack(app, 'integ-cdk-sfn-integ');

const input = new Pass(stack, 'TestInput', {
  parameters: {
    integ: true,
    number: 1,
  },
});

const expect = new AssertState(stack, 'TestAssert', {
  assert: Assert.expressions([
    Expr.expect(Expr.input()).toEqual(
      Expr.objectContaining({
        integ: true,
        number: Expr.anything(),
      }),
    ),
    Expr.expect(Expr.input('number')).not.toEqual(2),
  ]),
});

new StateMachine(stack, 'Test', {
  definition: Chain.start(input)
    .next(expect),
});
0.0.20

2 years ago

0.0.21

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago