add more tests, fix jsdoc, code style