Migrate tests to mocha and add test coverage.