If you’ve worked with Angular, and written unit tests, you’ve probably used TestBed.
I recently had to write an Express app using Typescript at work, which is something relatively new for me.
As I am a testing zealot and get scared if I don’t have good unit tests on my projects, I wanted to have a tool similar to Angular TestBed for configuring the tests in a predictable and speedy way.
Because I am foolish I decided to try and write my own.
This is the result of that :
https://www.npmjs.com/package/express-bed
If you implement your express routes as classes, and add a public create
method to them, which is passed an Express app instance, and does the actual app.get('/swankyUrl', (req, res) => ...
, then this tool should work for you too if you’re interested 🙂