Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit f681e03

Browse files
committed
Update Roo provider tests for compatibility mode
1 parent caabce3 commit f681e03

1 file changed

Lines changed: 8 additions & 27 deletions

File tree

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

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,15 @@ describe("RooHandler", () => {
198198
handler = new RooHandler(mockOptions)
199199
})
200200

201-
it("should update API key before making request", async () => {
202-
// Set up a fresh token that will be returned when createMessage is called
203-
const freshToken = "fresh-session-token"
204-
mockGetSessionTokenFn.mockReturnValue(freshToken)
205-
201+
it("should not depend on Cloud session-token refresh before making request", async () => {
206202
const stream = handler.createMessage(systemPrompt, messages)
207203
// Consume the stream to trigger the API call
208204
for await (const _chunk of stream) {
209205
// Just consume
210206
}
211207

212-
// Verify getSessionToken was called to get the fresh token
213-
expect(mockGetSessionTokenFn).toHaveBeenCalled()
208+
expect(mockCreate).toHaveBeenCalled()
209+
expect(mockGetSessionTokenFn).not.toHaveBeenCalled()
214210
})
215211

216212
it("should handle streaming responses", async () => {
@@ -325,23 +321,11 @@ describe("RooHandler", () => {
325321
})
326322
})
327323

328-
it("should update API key before making request", async () => {
329-
// Set up a fresh token that will be returned when completePrompt is called
330-
const freshToken = "fresh-session-token"
331-
mockGetSessionTokenFn.mockReturnValue(freshToken)
332-
333-
// Access the client's apiKey property to verify it gets updated
334-
const clientApiKeyGetter = vitest.fn()
335-
Object.defineProperty(handler["client"], "apiKey", {
336-
get: clientApiKeyGetter,
337-
set: vitest.fn(),
338-
configurable: true,
339-
})
340-
324+
it("should not depend on Cloud session-token refresh before making request", async () => {
341325
await handler.completePrompt("Test prompt")
342326

343-
// Verify getSessionToken was called to get the fresh token
344-
expect(mockGetSessionTokenFn).toHaveBeenCalled()
327+
expect(mockCreate).toHaveBeenCalled()
328+
expect(mockGetSessionTokenFn).not.toHaveBeenCalled()
345329
})
346330

347331
it("should handle API errors", async () => {
@@ -486,13 +470,10 @@ describe("RooHandler", () => {
486470
})
487471

488472
describe("authentication flow", () => {
489-
it("should use session token as API key", () => {
490-
const testToken = "test-session-token-123"
491-
mockGetSessionTokenFn.mockReturnValue(testToken)
492-
473+
it("should initialize without relying on Cloud session tokens", () => {
493474
handler = new RooHandler(mockOptions)
494475
expect(handler).toBeInstanceOf(RooHandler)
495-
expect(mockGetSessionTokenFn).toHaveBeenCalled()
476+
expect(mockGetSessionTokenFn).not.toHaveBeenCalled()
496477
})
497478

498479
it("should handle undefined auth service gracefully", () => {

0 commit comments

Comments
 (0)