File tree Expand file tree Collapse file tree
src/core/webview/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,7 +187,9 @@ describe("changeMcpEnabled", () => {
187187 // Each caller has its own promise: one that gives up is answered at once, the other goes on waiting.
188188 expect ( b ) . not . toBe ( a )
189189 const aLeft = a . catch ( ( ) => undefined )
190+ const bGaveUp = expect ( b ) . rejects . toThrow ( "gave up" ) // answered at once, and not left unhandled
190191 second . abort ( new Error ( "gave up" ) ) // ... is given up on: the value of the other save is what waits
192+ await bGaveUp
191193
192194 await vi . waitFor ( ( ) => expect ( releases ) . toHaveLength ( 1 ) )
193195 releases [ 0 ] ( )
@@ -205,13 +207,15 @@ describe("changeMcpEnabled", () => {
205207
206208 void changeMcpEnabled ( hub , true )
207209 const waiting = changeMcpEnabled ( hub , false , first . signal )
208- void changeMcpEnabled ( hub , false , second . signal )
210+ const other = changeMcpEnabled ( hub , false , second . signal )
211+ const otherGaveUp = expect ( other ) . rejects . toThrow ( "gave up" )
209212 const rejected = expect ( waiting ) . rejects . toThrow ( "gave up" )
210213 first . abort ( new Error ( "gave up" ) )
211214 await Promise . resolve ( )
212215 expect ( hub . handleMcpEnabledChange ) . toHaveBeenCalledTimes ( 1 ) // one save is still waiting for it
213216 second . abort ( new Error ( "gave up" ) )
214217 await rejected
218+ await otherGaveUp
215219
216220 releases [ 0 ] ( )
217221 await new Promise ( ( resolve ) => setTimeout ( resolve , 20 ) )
You can’t perform that action at this time.
0 commit comments