# help

Noah D

06/08/2022, 12:05 AM
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 🙏


06/08/2022, 2:11 PM
we're going to be sharing our thinking on this soon
I will say AWS Cognito makes proper integration tests extremely difficult

Geoff Seemueller

06/08/2022, 8:39 PM
@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.

Noah D

06/09/2022, 10:58 AM
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