Mocking – not testing – private functions in JavaScript

[ original gist 12 July 2013 ]

Instead of trying to extract a private function, we can rely on mocking/spying. This gist post shows how to use the Function() constructor to replace an internal call so that we can mock, spy or stub.

Continue reading

Advertisements