Adding tests

Covering error.js and api_server.js, tests need implementing for
api_server.