Added more JS unit tests

Also fixed an issue where it would never use the MongoRepository