11th August, 2026
Beanstalk is a simple, easy-to-use job queue system. I had been using NodeJS with the node-beanstalk package to interface with it but it was causing a performance bottleneck so I decided to write my own client. This gave me a 37x speedup in my application!
Read More >
10th June, 2026
To provide an implementation of a mock function you must know its function signature, but whichever one of the overloads you choose, TypeScript will give you an error. The fix is actually quite simple: use the signature of the actual implementation, not the overloads.
Read More >
18th September, 2023
The ability to provide a mock implementation of functionality is essential to unit testing, however the method for doing so with Jest and TypeScript is not well documented. This tutorial aims to elucidate the method for mocking a JavaScript library that is loaded into your TypeScript project. This is demonstrated with the ws WebSocket library but applies equally to any library, including built-in NodeJS modules.
Read More >
6th February, 2023
Performing a real HTTP request in a unit test can make it slow and brittle, so the solution is to mock the Node HTTP library. This guide will show you how to create mock objects that simulate successful and unsuccessful HTTP requests.
Read More >