Skip to content

TestState

Source: src/AWS/StepFunctions/TestState.ts

Runtime binding for states:TestState — execute a single ASL state (Task, Pass, Wait, Choice, Succeed, Fail) without creating a state machine, optionally with mocked service integrations.

Service-scoped (no resource argument). States that call other services (e.g. lambda:invoke) need a roleArn the caller can iam:PassRole — intrinsic states (Pass/Choice/Succeed/Fail) run without one.

const testState = yield* StepFunctions.TestState();
const result = yield* testState({
definition: JSON.stringify({
Type: "Pass",
QueryLanguage: "JSONata",
Output: "{% $states.input.value * 2 %}",
End: true,
}),
input: JSON.stringify({ value: 21 }),
});
// result.status === "SUCCEEDED", result.output === "42"