Add test for error event