Refactor testHelper.js