Refactor tests and created test_case.js