@@ -118,16 +118,16 @@ describe('tool events (dispatch → model + side effects)', () => {
118118 {
119119 scope : 'personal' ,
120120 output : { scope : 'personal' } ,
121- environmentQueryKey : environmentKeys . personal ( ) ,
121+ environmentQueryKeys : [ environmentKeys . personal ( ) , environmentKeys . workspaces ( ) ] ,
122122 } ,
123123 {
124124 scope : 'workspace' ,
125125 output : { scope : 'workspace' , workspaceId : 'workspace-from-result' } ,
126- environmentQueryKey : environmentKeys . workspace ( 'workspace-from-result' ) ,
126+ environmentQueryKeys : [ environmentKeys . workspace ( 'workspace-from-result' ) ] ,
127127 } ,
128128 ] ) (
129129 'refreshes the $scope environment before selector caches after Copilot saves secrets' ,
130- async ( { output, environmentQueryKey } ) => {
130+ async ( { output, environmentQueryKeys } ) => {
131131 const deps = makeStreamLoopDeps ( )
132132 const invalidateQueries = vi . mocked ( deps . queryClient . invalidateQueries )
133133 invalidateQueries . mockResolvedValue ( undefined )
@@ -139,9 +139,11 @@ describe('tool events (dispatch → model + side effects)', () => {
139139 toolResult ( 'environment-1' , true , SetEnvironmentVariables . id , output )
140140 )
141141
142- await vi . waitFor ( ( ) => expect ( invalidateQueries ) . toHaveBeenCalledTimes ( 5 ) )
142+ await vi . waitFor ( ( ) =>
143+ expect ( invalidateQueries ) . toHaveBeenCalledTimes ( environmentQueryKeys . length + 4 )
144+ )
143145 expect ( invalidateQueries . mock . calls . map ( ( [ filters ] ) => filters ?. queryKey ) ) . toEqual ( [
144- environmentQueryKey ,
146+ ... environmentQueryKeys ,
145147 environmentDependentSelectorKeys . primary ,
146148 environmentDependentSelectorKeys . dynamicDetails ,
147149 environmentDependentSelectorKeys . workflowDetails ,
0 commit comments