Re:Programmers Should Never Trust Anyone, Not Even Themselves
by bloopernova on Monday July 01, 2024 @11:31AM
(#40846782)
I (sysadmin/devops) am writing some nodejs and the complexity of the tests is confusing to me. I'm a nodejs beginner to be sure, and I'm not experienced enough to verify what copilot gives me.
All those mocks, and other Jest code, all seem overly complicated but I don't know of anything "better".
Re:Programmers Should Never Trust Anyone, Not Even Themselves
by throwaway2037 on Friday July 05, 2024 @03:48AM
(#40880600)
Don't be ashamed of this. I am a veteran of automated testing (writing automated unit tests for 10+ years). I am constantly disappointed in myself how bloody complicated it is to test some "simple code". And, then I go back and look at old unit tests from a few months ago: "Who wrote this shit!? <git blame> Oh, me."
When a codebase gets too big, and devs gets too clever with their tests, the whole test suite becomes complicated.
If your test suite is approaching the complexity of the actual codebase (what with layers of mocks and fixtures that are subtly interdependent,) how could you be expected to trust a test you wrote more than the code you wrote.