converted manual test to mocha test