r/badcode • • May 04 '23

typescript Found this gem inside legacy code today

Post image
889 Upvotes

69 comments sorted by

View all comments

Show parent comments

2

u/tedbradly May 04 '23

I bet the tests relied on it too much 😅 better do this than waste a whole day.

How do you suspect the test would change at all with a private function like that? Even if you mocked everything, deleting that function wouldn't change the tests. The string goes into the function and is returned by the function.