text: import sinon from 'sinon'
  
  import inMemoryBus from '../src'
  
  describe('inMemoryBus', () => {
    it('publish', () => {
      const busInstance = inMemoryBus()
  
      const event1 = { type: 'ONE', payload: { data: 'AAA' } }
      const event2 = { type: 'TWO', payload: { data: 'BBB' } }
  
      const triggerSpy = sinon.spy()
      busInstance.subscribe(triggerSpy)
  
      busInstance.publish(event1)
      busInstance.publish(event2)
  
      expect(triggerSpy.callCount).toEqual(2)
      expect(triggerSpy.args[0][0]).toEqual(event1)
      expect(triggerSpy.args[1][0]).toEqual(event2)
    })
  
    it('publish handles subscription', () => {
      const busInstance = inMemoryBus()
      const event = { type: 'ONE', payload: { data: 'AAA' } }
  
      const eventHandlerSpy = sinon.spy()
      busInstance.subscribe(eventHandlerSpy)
  
      busInstance.publish(event)
  
      expect(eventHandlerSpy.callCount).toEqual(1)
      expect(eventHandlerSpy.lastCall.args[0]).toEqual(event)
    })
  })
  