DRYing unittests and converting them to mocha