{"id":17340799,"url":"https://github.com/kenfdev/stepfunctions-testing","last_synced_at":"2025-10-08T04:09:51.422Z","repository":{"id":57370798,"uuid":"462144658","full_name":"kenfdev/stepfunctions-testing","owner":"kenfdev","description":"Step Functions testing library.","archived":false,"fork":false,"pushed_at":"2023-12-15T05:30:12.000Z","size":12,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T19:07:38.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kenfdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-22T04:58:45.000Z","updated_at":"2023-06-04T20:34:43.000Z","dependencies_parsed_at":"2025-02-25T22:43:11.475Z","dependency_job_id":null,"html_url":"https://github.com/kenfdev/stepfunctions-testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenfdev%2Fstepfunctions-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenfdev%2Fstepfunctions-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenfdev%2Fstepfunctions-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenfdev%2Fstepfunctions-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenfdev","download_url":"https://codeload.github.com/kenfdev/stepfunctions-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248943456,"owners_count":21186958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T15:46:32.205Z","updated_at":"2025-10-08T04:09:46.374Z","avatar_url":"https://github.com/kenfdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Step Functions Testing Library\n\n## Features\n\n- Create a [MockConfigFile](https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-test-sm-exec.html) with JavaScript\n\n\n### Install\n\n```sh\nnpm i stepfunctions-testing\n```\n## Usage\n\n### Creating a mocked response\n\n#### `Return` a response\n\n```js\nconst checkIdentityLambdaMockedSuccess = new MockedResponse(\n  'CheckIdentityLambdaMockedSuccess'\n).return\u003cany\u003e({\n  StatusCode: 200,\n  Payload: {\n    statusCode: 200,\n    body: JSON.stringify({\n      approved: true,\n      message: 'identity validation passed',\n    }),\n  },\n});\n```\n\n#### `Throw` a response\n\n```js\nconst checkIdentityLambdaMockedThrowError = new MockedResponse(\n  'CheckIdentityLambdaMockedThrowError'\n).throw('CustomValidationError', 'Check Identity Validation Failed');\n```\n\n#### Repeating responses\n\n```js\nconst checkIdentityLambdaMockedThrowError = new MockedResponse(\n  'CheckIdentityLambdaMockedThrowError'\n).throw('CustomValidationError', 'Check Identity Validation Failed', /* repeat the response 3 times. total becomes 4 */ 3);\n```\n\n### Full example\n\n```js\n// Create mocked responses\nconst checkIdentityLambdaMockedSuccess = new MockedResponse(\n  'CheckIdentityLambdaMockedSuccess'\n).return\u003cany\u003e({\n  StatusCode: 200,\n  Payload: {\n    statusCode: 200,\n    body: JSON.stringify({\n      approved: true,\n      message: 'identity validation passed',\n    }),\n  },\n});\n\nconst checkAddressLambdaMockedSuccess = new MockedResponse(\n  'CheckAddressLambdaMockedSuccess'\n).return\u003cany\u003e({\n  StatusCode: 200,\n  Payload: {\n    statusCode: 200,\n    body: JSON.stringify({\n      approved: true,\n      message: 'address validation passed',\n    }),\n  },\n});\n\n// Create a state machine test definition\nconst stateMachineTestDefinition = new StateMachineTestDefinition('SomeStateMachineName')\n  .addTestCase(\n    new StateMachineTestCase('HappyPathTest')\n      .withInput(input)\n      .addMockedState(\n        'CheckIdentity',\n        checkIdentityLambdaMockedSuccess\n      )\n      .addMockedState(\n        'CheckAddress',\n        checkAddressLambdaMockedSuccess\n      )\n  );\n\n// Create a config\nconst config = new StepFunctionsMockConfig()\n      .addTestDefinition(stateMachineTestDefinition);\n\n// Convert the config object to JSON\n// You can write this down to a file to be used by step functions local\nconfig.toJSON();\n```\n\n## License\n\nstepfunctions-testing is available under the terms of [MIT License](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenfdev%2Fstepfunctions-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenfdev%2Fstepfunctions-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenfdev%2Fstepfunctions-testing/lists"}