Unit tests for userAuthenticate.js and fixes to existing unit tests.