Add tests for clearBuffer