Add 3 phase test case + JSLint clean test code