rewrote test.js to get test case passed