2021-06-18 13:05:06 +02:00
|
|
|
import Emitter from './Emitter'
|
|
|
|
|
2021-10-04 20:06:12 +02:00
|
|
|
describe.skip('dataverse-experiments.Emitter', () => {
|
2021-06-18 13:05:06 +02:00
|
|
|
it('should work', () => {
|
|
|
|
const e: Emitter<string> = new Emitter()
|
|
|
|
e.emit('no one will see this')
|
|
|
|
e.emit('nor this')
|
|
|
|
|
|
|
|
const tappedEvents: string[] = []
|
|
|
|
const untap = e.tappable.tap((payload) => {
|
|
|
|
tappedEvents.push(payload)
|
|
|
|
})
|
|
|
|
e.emit('foo')
|
|
|
|
e.emit('bar')
|
|
|
|
untap()
|
|
|
|
e.emit('baz')
|
|
|
|
expect(tappedEvents).toMatchObject(['foo', 'bar'])
|
|
|
|
})
|
|
|
|
})
|