Port code grant handling test cases to Mocha.