moved test function into mocha