Expand tests

Use mocha's BDD interface since it supports async tests, and add tests
for the command-line script.