@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from 'vitest'
22import { ClientEventBus } from '@tanstack/devtools-event-bus/client'
33import { EventClient } from '../src'
44
5+ vi . spyOn ( BroadcastChannel . prototype , 'postMessage' ) . mockImplementation ( ( ) => { } )
56// start the client bus for testing
67const bus = new ClientEventBus ( )
78bus . start ( )
@@ -55,7 +56,7 @@ describe('EventClient', () => {
5556 const targetEmitSpy = vi . spyOn ( target , 'dispatchEvent' )
5657 const targetListenSpy = vi . spyOn ( target , 'addEventListener' )
5758 const targetRemoveSpy = vi . spyOn ( target , 'removeEventListener' )
58- const cleanup = client . on ( 'test:event' , ( ) => { } )
59+ const cleanup = client . on ( 'test:event' , ( ) => { } )
5960 cleanup ( )
6061 client . emit ( 'test:event' , { foo : 'bar' } )
6162 expect ( targetEmitSpy ) . toHaveBeenCalledWith ( expect . any ( Event ) )
@@ -79,7 +80,7 @@ describe('EventClient', () => {
7980 const targetEmitSpy = vi . spyOn ( target , 'dispatchEvent' )
8081 const targetListenSpy = vi . spyOn ( target , 'addEventListener' )
8182 const targetRemoveSpy = vi . spyOn ( target , 'removeEventListener' )
82- const cleanup = client . on ( 'test:event' , ( ) => { } )
83+ const cleanup = client . on ( 'test:event' , ( ) => { } )
8384 cleanup ( )
8485 client . emit ( 'test:event' , { foo : 'bar' } )
8586 expect ( targetEmitSpy ) . toHaveBeenCalledWith ( expect . any ( Event ) )
@@ -102,7 +103,7 @@ describe('EventClient', () => {
102103 } )
103104
104105 const eventBusSpy = vi . spyOn ( clientBusEmitTarget , 'addEventListener' )
105- client . on ( 'event' , ( ) => { } )
106+ client . on ( 'event' , ( ) => { } )
106107 expect ( eventBusSpy ) . toHaveBeenCalledWith (
107108 'test:event' ,
108109 expect . any ( Function ) ,
0 commit comments