Tests rewritten in mocha/chai