refactor to module.exports
simplify mocha invocation
add api test coverage
add app test coverage