Re-factor tests to use mocha.

Re-factor test code to use mocha.js as test framework.