refactor for more mocha tests