A collection of 5 posts
Mocking functions is really easy to do in Jest but what if the module is exporting a functions directly instead of bundling them in a class? Well, it is actually quite easy to do if you know this simple trick.
We recently tried to optimize a Lambda function that is transferring files between two systems through REST-APIs. It was downloading a file from one system, splitting it up into chunks of a few MB before uploading the chunks to the destination system.
For over one year my current team was using the Live Share plugin for VS Code and more recently also Code With Me for IntelliJ on a daily basis due to our remote setup. While initially I really loved this highly collaborative way of remote pair programming I now see a lot of issues with it.
Today I had a little confrontation with Jest while writing unit tests for a Lambda function in TypeScript. The function is using the AWS SDK to send messages to an SQS queue. While this mocking problem seems very specific at first, mocking other dependencies would yield similar results.