Skip to content

Commit 6c97906

Browse files
committed
PR feedback
1 parent 2a8143a commit 6c97906

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/api/providers/__tests__/roo.spec.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)