🌈 Lascapi ⁂lascapi@social.tchncs.de
Oct 23, 2026, 6:52 AMMy though of the day :
Given a private function in #typescript, you should not try to unit test it with #jest.
What do you think about it?
My though of the day :
Given a private function in #typescript, you should not try to unit test it with #jest.
What do you think about it?
Do: test global
Dont: test the tiny details
@lascapi
Your private function lives because of a test you wrote before writing the said function, to make the test to pass. So it is already tested.
@jeko Perfect reframing ! :ablobcatheart:
But, sometimes my task is to improve legacy code (which is not tested by definition), and the temptation was big to try to test the private function. 🙊
@lascapi
Of course ! Haha
If you manage to test the public fonctions which call the private one instead, that would be a win.
It might be a much bigger effort. So you make your trade off. It's OK ❤️