1'use strict'; 2 3const common = require('../common'); 4const EventEmitter = require('events'); 5const assert = require('assert'); 6 7const ee = new EventEmitter(); 8const foo = Symbol('foo'); 9const listener = common.mustCall(); 10 11ee.on(foo, listener); 12assert.deepStrictEqual(ee.listeners(foo), [listener]); 13 14ee.emit(foo); 15 16ee.removeAllListeners(); 17assert.deepStrictEqual(ee.listeners(foo), []); 18 19ee.on(foo, listener); 20assert.deepStrictEqual(ee.listeners(foo), [listener]); 21 22ee.removeListener(foo, listener); 23assert.deepStrictEqual(ee.listeners(foo), []); 24