Move unrelated tests out of test/env.js and refactor remaining tests.