Unit tests for AWS SDK v3 with Jest: Testing S3
Published in
4 min readMay 5, 2022
Introduction
Back in December 2020, version 3 of the AWS SDK for Javascript became generally available. This brought improved typings as it had been rewritten in Typescript. The introduction of a new middleware stack and a modular architecture made it easier to use. We can now import a specific package. In the v2 SDK, we had no choice but to import all the AWS services in one package. But it meant that there was a need for a whole new mocking library for creating unit tests.
Fast forward many months later and an AWS mocking library was built for the Javascript AWS SDK v3. The AWS SDK Client mock.
Feature, not a bug
There is a lot of documentation available about how to use the AWS SDK Client Mock. So I won’t go into the benefits of using this well-written module in this article.
Instead this article will cover one of the quirks of using this module. It…