Port test cases for handle middleware to mocha.