@@ -110,7 +110,7 @@ describe('handleResourceEvent removal', () => {
110110 } )
111111
112112 it . each ( [ 'workflow' , 'table' , 'file' , 'knowledgebase' , 'log' ] as const ) (
113- 'opens an authorized %s read without invalidating or reconciling editable content ' ,
113+ 'ignores an authorized %s read without opening, saving or changing focus ' ,
114114 ( type ) => {
115115 const onResourceEvent = vi . fn ( )
116116 const deps = makeStreamLoopDeps ( { onResourceEventRef : { current : onResourceEvent } } )
@@ -124,12 +124,13 @@ describe('handleResourceEvent removal', () => {
124124 resource : { type, id : 'addressed' , title : 'Addressed resource' } ,
125125 } ,
126126 } )
127- expect ( onResourceEvent ) . toHaveBeenCalledWith ( 'addressed' )
128- expect ( deps . setResources ) . toHaveBeenCalled ( )
127+ expect ( onResourceEvent ) . not . toHaveBeenCalled ( )
128+ expect ( deps . setResources ) . not . toHaveBeenCalled ( )
129129 expect ( deps . addResource ) . not . toHaveBeenCalled ( )
130130 expect ( mocks . invalidateResourceQueries ) . not . toHaveBeenCalled ( )
131131 expect ( mocks . notifyWorkflowExternalUpdate ) . not . toHaveBeenCalled ( )
132132 expect ( deps . ensureWorkflowInRegistry ) . not . toHaveBeenCalled ( )
133+ expect ( deps . queryClient . invalidateQueries ) . not . toHaveBeenCalled ( )
133134 }
134135 )
135136
@@ -152,13 +153,12 @@ describe('handleResourceEvent removal', () => {
152153 expect ( deps . setResources ) . not . toHaveBeenCalled ( )
153154 expect ( mocks . invalidateResourceQueries ) . not . toHaveBeenCalled ( )
154155 expect ( mocks . notifyWorkflowExternalUpdate ) . not . toHaveBeenCalled ( )
155- expect ( deps . queryClient . invalidateQueries ) . toHaveBeenCalledWith ( {
156- queryKey : [ 'mothership-chats' , 'detail' , 'chat' ] ,
157- } )
156+ expect ( deps . queryClient . invalidateQueries ) . not . toHaveBeenCalled ( )
158157 } )
159158
160- it ( 'still reconciles a committed workflow edit after opening it for a read' , ( ) => {
161- const deps = makeStreamLoopDeps ( )
159+ it ( 'still opens and reconciles a committed workflow edit after a read' , ( ) => {
160+ const onResourceEvent = vi . fn ( )
161+ const deps = makeStreamLoopDeps ( { onResourceEventRef : { current : onResourceEvent } } )
162162 const event = removeEvent ( 'workflow' , 'wf' )
163163 handleResourceEvent (
164164 { deps } as StreamLoopContext ,
@@ -173,6 +173,8 @@ describe('handleResourceEvent removal', () => {
173173 )
174174 expect ( mocks . invalidateResourceQueries ) . toHaveBeenCalledTimes ( 1 )
175175 expect ( mocks . notifyWorkflowExternalUpdate ) . toHaveBeenCalledExactlyOnceWith ( 'wf' )
176+ expect ( deps . addResource ) . toHaveBeenCalledTimes ( 1 )
177+ expect ( onResourceEvent ) . toHaveBeenCalledExactlyOnceWith ( 'wf' )
176178 } )
177179
178180 it . each ( [
0 commit comments