-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Testing Factories for AWS Data Objects #445
Comments
@heitorlessa it is worth thinking about this across both Python, Java and Typescript (aws-powertools/powertools-lambda-python#1169) |
Thanks for opening this issue @simonireilly. As a former AWS customer, I would like to say that this is something I wanted myself as well, back then. |
I've been using @serverless/event-mocks for this, there are a few others, all are out of date and not maintained. |
For Python is have a lot of mocks and sample events. So whichever solution we have in mind it would be great to has the potential for reuse across python, typescript, Java and .Net. |
If any ESM users are looking for an utility similar to what's being proposed here: I've been shipping my own set of test data factories for Lambda events, built using the same combo ( |
Description of the proposal
There should be a consistent way to produce test fixtures for AWS lambda environments
Name of the core utility (and consequently the folders that contain the libraries):
packages/factories
Justification
When it comes to making effective use of AWS in unit and integration testing, developers will create data objects which have the interfaces of the 'aws-lambda' types package.
This is true, even within this project;
These untyped objects become a cause for churn, and often because a single source of truth is not present, they can misdiagnose behaviors through simple omission of fields.
Goals
Proposed API
There is an example here that utilizes
faker
andfishery
to create type compliant factories that can be deep merged to allow for standard testing objects:Installation:
Usage
Consider the following test that is written in #364
This test becomes:
The text was updated successfully, but these errors were encountered: