reorganized text chat related test code