Added a test for preventing duplicate listeners.