JS unit tests refactoring