Auto-install unit tests

This adds unit tests for auto-installing extensions
* actually only 1 "test" to Extension Manager tests
* refactored code to facilitate testing
* added jsdoc annotations
* minor code cleanup
* fixes #9576

cc @dangoor