Fix all failing Mocha tests.

JSHint still complains because some functions are still missing.
Get rid of all JSHint errors.