Open AnilMaktala opened 1 year ago
Last I checked the team responsible for maintaining the amplify-appsync-simulator does not consider testing outside of Amplify to be a supported use case, see their response in this issue: https://github.com/aws-amplify/amplify-category-api/issues/692
That being said there are ways to use it that I've found a few resources for and used that to create this starter template for creating an aws appsync project: https://github.com/tqhoughton/aws-cdk-appsync-starter-ts
Here's an example of a test that sets up a lambda resolver: https://github.com/tqhoughton/aws-cdk-appsync-starter-ts/blob/master/test/private/Query_getMenu.test.ts
The biggest pain point is that you can't rely on the default mapping templates for lambda resolvers, you have to manually define the VTL templates that would simulate a lambda resolver response. You also cannot simulate lambda authorizers even though there is a type defined for it for some reason. I also never quite figured out how to get the more advanced resolver types to work, like Pipeline resolvers and I'd be surprised if they support the new javascript resolver definitions.
I am wondering if it is possible to use the amplify-appsync-simulator in a standalone manner. We have an AWS AppSync API built out of CloudFormation templates and Python, not using the Amplify framework. It would be a big benefit in terms of cheap integration testing if we could run the AppSync API locally. We have a docker-compose based local environment with dynamodb-local where we already run basic integration tests with dynamodb.
So my question is would such a use case be something you are seeking to support with the amplify-appsync-simulator package? And if so, perhaps there could be some lightweight documentation on how to do so in a stable/supported way.
Please refer this issue for more info