In this two-part miniseries, I show you a practical example of adding unit tests to existing code. This first part focuses on adding tests while not changing the original code. There are also a few things in the test setup that are not ideal, like how dates are used in the test code, using a real API key and doing actual card charges. I address these things in part 2, where I also show how refactoring the code simplifies test writing while improving the design as well.
- Part 1: https://youtu.be/ULxMQ57engo.
- Part 2: https://youtu.be/NI5IGAim8XU.