Refactor ChatRoom tests (move code to utils.js)