basic mocha test setup, fixed some function bugs