add test for api and minor jshint fixes