Fix the typo and refactor test cases