Added tests for message recording logic