Adding Mocha tests, fixing some JSlint hints.