Hacker News new | ask | show | jobs
by yonaguska 1163 days ago
> you can't generally mock a function

Yes, this is generally true, so the workaround is to put your function in a class, and use an interface + dependency injection to mock what you need. Sometimes it's a hassle.