add enum type test and refactor