0.6.3 • Published 7 months ago

fake-step-functions v0.6.3

Weekly downloads
26
License
Apache-2.0
Repository
github
Last release
7 months ago

fake-step-functions

A lightweight unit testing toolkit for Amazon States Language.

GitHub Workflows Status npm version

const { FakeStateMachine } = require('fake-step-functions');

describe('FakeStateMachine.run', () => {
  const definition = {
    Comment: 'https://states-language.net/spec.html#data',
    StartAt: 'AddNumbers',
    States: {
      AddNumbers: {
        Type: 'Task',
        Resource: 'arn:aws:lambda:us-east-1:123456789012:function:Add',
        InputPath: '$.numbers',
        ResultPath: '$.sum',
        End: true,
      },
    },
  };
  const fakeResources = {
    'arn:aws:lambda:us-east-1:123456789012:function:Add': numbers => numbers.val1 + numbers.val2,
  };
  const fakeStateMachine = new FakeStateMachine(definition, fakeResources);

  test('should execute the state machine with fakeResource', async () => {
    const runStateResult = await fakeStateMachine.run({
      title: 'Numbers to add',
      numbers: { val1: 3, val2: 4 },
    });

    expect(runStateResult.data).toEqual({
      title: 'Numbers to add',
      numbers: { val1: 3, val2: 4 },
      sum: 7,
    });
  });
});

Release

In order to release new version to npm, create a commit using npm version patch -m "Release %s" and push it. See the npm-publish-action step in .github/workflows/publish.yml.

References

Specifications

Similar projects

At 2022, AWS Step Functions Local is a primary choice to test ASL locally. See "Testing Step Functions State Machines Locally".

0.6.3

7 months ago

0.6.1

1 year ago

0.5.2

1 year ago

0.6.0

1 year ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.1

3 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago