mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
e8d542af0f
* refactor: remove unused API definition routes * feat: add support for proxy keys * feat: support listening for any event * feat: embed proxy endpoints * refactor: add an experimental flag for the embedded proxy
23 lines
747 B
TypeScript
23 lines
747 B
TypeScript
import { AnyEventEmitter } from './anyEventEmitter';
|
|
|
|
test('AnyEventEmitter', () => {
|
|
const events = [];
|
|
const results = [];
|
|
|
|
class MyEventEmitter extends AnyEventEmitter {}
|
|
const myEventEmitter = new MyEventEmitter();
|
|
|
|
myEventEmitter.on('a', () => events.push('a'));
|
|
myEventEmitter.on('b', () => events.push('b'));
|
|
myEventEmitter.on('c', () => events.push('c'));
|
|
myEventEmitter.on('*', () => events.push('*'));
|
|
|
|
results.push(myEventEmitter.emit('a'));
|
|
results.push(myEventEmitter.emit('b'));
|
|
results.push(myEventEmitter.emit('c'));
|
|
results.push(myEventEmitter.emit('d'));
|
|
|
|
expect(events).toEqual(['*', 'a', '*', 'b', '*', 'c', '*']);
|
|
expect(results).toEqual([true, true, true, false]);
|
|
});
|