Wondering if anyone had any insights or example co...
# help
n
Wondering if anyone had any insights or example code of how they perform integration tests atm using jest and SST? I would ideally be keen to test at a high level my api and validate adding/getting objects works as expected, without really caring about implementation detail. Though am a bit unsure how I would authenticate my requests in a test suite, i am currently using aws cognito and iam (similar to what is seen in the guide) as my auth for my api. Any help would be greatly appreciated 🙏
t
we're going to be sharing our thinking on this soon
I will say AWS Cognito makes proper integration tests extremely difficult
g
@Noah D I've had great success with using dependency injection to unit test the handlers . If you are dead set on maintaining integration tests, cypress or another e2e framework like playwrite might be your best bet. I did it with jest for about a month and I will tell you it's not worth the trouble when Cognito is involved.
n
Thanks for the thoughts on this guys, yea figured it wouldn't be super easy to achieve. Ideally would want to ensure my api is acting as I would expect from a pure input & output perspective. But might settle for some solid unit tests in the interim. Keen to hear more about what you guys have come up with @thdxr