lambda-tools icon indicating copy to clipboard operation
lambda-tools copied to clipboard

[:new:] Add tests

Open henrinormak opened this issue 9 years ago • 0 comments

Type: :new:

Description: Currently, none of the scripts are covered by tests. Add tests to at least cover the core functionality in deploy and deploy-single, as these two affect production the most.

Motivation: Having test coverage allows for more confident changes in the codebase, thus opening the door to more people for contributing. Also, test coverage is important to validate the assumptions that the current code makes/forces the user to make.

Affected features:

  • deploy and deploy-single at minimal
  • Optionally also execute and run

Proposed implementation:

  • Testing these scripts is relatively difficult, however with deploy logic, we can validate that the produced Lambda function bundles are accurate, as well as the API and CF templates.
  • Easier tests would involve validating that options passed to scripts are respected, that execute triggers the correct file/event combo etc.
  • Testing run can involve testing that api.json watching works, that api.json is properly parsed as JSON Swagger and that an actual server with expected endpoints is raised at the correct port.

Testing strategy:

  • Run the tests :smile:

Example usage: npm run test should actually do something, rather than the current no-op.

henrinormak avatar Apr 08 '16 08:04 henrinormak