chat tests and refactoring