Re:How JavaScript Works: deep dive into call, apply, and bind
by shawnz on Saturday July 10, 2021 @07:26AM
(#27792646)
The most obvious reason is that they're private and not normally reachable from your test code.
But even conceptually there are problems with testing private methods. For example they likely expect to be called only while the class is in some specific state or in the middle of some atomic operation. Otherwise they could have just been made public.
But even conceptually there are problems with testing private methods. For example they likely expect to be called only while the class is in some specific state or in the middle of some atomic operation. Otherwise they could have just been made public.