Refactor client side tests and add server side mocha tests