refactoring the index.js unit test