Cat looking depressed because their Jest unit tests for AWS SDK v3 are not working correctly
Even cats hate broken unit tests. Photo by 傅甬 华 on Unsplash.

Unit tests for AWS SDK v3 with Jest: Testing S3

Kris Raven
CodeX
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…

--

--

Kris Raven
CodeX
Writer for

Quality Engineering Manager | A wholesome mix of QA, Automated Testing, music and philosophy | Enjoys unit tests | Favours integration tests