File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
src/api/providers/__tests__ Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -404,21 +404,24 @@ describe("RooHandler", () => {
404404 mockHasInstanceFn . mockReturnValue ( true )
405405 // Mock CloudService with undefined authService
406406 const originalGetter = Object . getOwnPropertyDescriptor ( CloudService , "instance" ) ?. get
407- Object . defineProperty ( CloudService , "instance" , {
408- get : ( ) => ( { authService : undefined } ) ,
409- configurable : true ,
410- } )
411407
412- expect ( ( ) => {
413- new RooHandler ( mockOptions )
414- } ) . toThrow ( "Authentication required for Roo Code Cloud" )
415-
416- // Restore original getter
417- if ( originalGetter ) {
408+ try {
418409 Object . defineProperty ( CloudService , "instance" , {
419- get : originalGetter ,
410+ get : ( ) => ( { authService : undefined } ) ,
420411 configurable : true ,
421412 } )
413+
414+ expect ( ( ) => {
415+ new RooHandler ( mockOptions )
416+ } ) . toThrow ( "Authentication required for Roo Code Cloud" )
417+ } finally {
418+ // Always restore original getter, even if test fails
419+ if ( originalGetter ) {
420+ Object . defineProperty ( CloudService , "instance" , {
421+ get : originalGetter ,
422+ configurable : true ,
423+ } )
424+ }
422425 }
423426 } )
424427
You can’t perform that action at this time.
0 commit comments