add mocha tests for api