11import { authMockFns , createMockRequest , workflowAuthzMockFns } from '@sim/testing'
2+ import { executionSignalMockFns } from '@sim/testing/mocks/execution-signal.mock'
23import { beforeEach , describe , expect , it , vi } from 'vitest'
34import type { ExecutionEventEntry } from '@/lib/execution/event-buffer'
45
5- const { mockReadExecutionEventsState, mockReadExecutionMetaState, mockSubscribe } = vi . hoisted (
6- ( ) => ( {
7- mockReadExecutionEventsState : vi . fn ( ) ,
8- mockReadExecutionMetaState : vi . fn ( ) ,
9- mockSubscribe : vi . fn ( ) ,
10- } )
11- )
6+ const { mockReadExecutionEventsState, mockReadExecutionMetaState } = vi . hoisted ( ( ) => ( {
7+ mockReadExecutionEventsState : vi . fn ( ) ,
8+ mockReadExecutionMetaState : vi . fn ( ) ,
9+ } ) )
10+ const mockSubscribe = executionSignalMockFns . mockSubscribe
1211
1312const mockAuthorizeWorkflowByWorkspacePermission =
1413 workflowAuthzMockFns . mockAuthorizeWorkflowByWorkspacePermission
@@ -19,10 +18,6 @@ vi.mock('@/lib/execution/event-buffer', () => ({
1918 readExecutionMetaState : mockReadExecutionMetaState ,
2019} ) )
2120
22- vi . mock ( '@/lib/execution/signal' , ( ) => ( {
23- getExecutionSignalHub : ( ) => ( { subscribe : mockSubscribe } ) ,
24- } ) )
25-
2621import { GET } from './route'
2722
2823const mockGetSession = authMockFns . mockGetSession
@@ -191,7 +186,7 @@ describe('execution stream reconnect route', () => {
191186 let signalHandler : ( ( reason : 'event' ) => void ) | undefined
192187 mockSubscribe . mockImplementationOnce ( async ( _executionId , handler ) => {
193188 signalHandler = handler
194- return vi . fn ( )
189+ return vi . fn < ( ) => void > ( )
195190 } )
196191 mockReadExecutionMetaState
197192 . mockResolvedValueOnce ( {
@@ -253,7 +248,7 @@ describe('execution stream reconnect route', () => {
253248 let signalHandler : ( ( reason : 'event' ) => void ) | undefined
254249 mockSubscribe . mockImplementationOnce ( async ( _executionId , handler ) => {
255250 signalHandler = handler
256- return vi . fn ( )
251+ return vi . fn < ( ) => void > ( )
257252 } )
258253 const staleActiveMeta = {
259254 status : 'found' as const ,
@@ -313,7 +308,7 @@ describe('execution stream reconnect route', () => {
313308 it ( 'fails the observer closed when its Redis signal subscription becomes unavailable' , async ( ) => {
314309 mockSubscribe . mockImplementationOnce ( async ( _executionId , handler ) => {
315310 queueMicrotask ( ( ) => handler ( 'unavailable' ) )
316- return vi . fn ( )
311+ return vi . fn < ( ) => void > ( )
317312 } )
318313 const req = createMockRequest (
319314 'GET' ,
0 commit comments