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".
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."
All those mocks, and other Jest code, all seem overly complicated but I don't know of anything "better".