Using context.Context to mock API clients
What's this blog post about?
The text discusses a pattern for mocking external client libraries in Go while keeping the code simple and ensuring all the code down a call stack uses the same mock client. This is achieved by generating a mock using tools like interfacer and gomock, and then injecting it with context.Context. The resulting test suite improves developer productivity when writing tests.
Company
Incident.io
Date published
Dec. 21, 2021
Author(s)
Lawrence Jones
Word count
1370
Language
English
Hacker News points
None found.