added test cases for apis in mocha, written test cases for apis need to refactor this code