mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-03 02:22:24 +00:00
test(oauth): restoring mocked global
This commit is contained in:
parent
4f62b4043f
commit
dab4e2cece
1 changed files with 6 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it, expect, vi, beforeEach } from "vitest"
|
||||
import { describe, it, expect, vi, beforeEach, afterAll } from "vitest"
|
||||
|
||||
// Mock the SDK's discoverOAuthProtectedResourceMetadata
|
||||
vi.mock("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
||||
|
|
@ -9,6 +9,7 @@ import { discoverOAuthProtectedResourceMetadata } from "@modelcontextprotocol/sd
|
|||
import { fetchOAuthAuthServerMetadata } from "../oauth"
|
||||
|
||||
const mockFetch = vi.fn()
|
||||
const originalFetch = global.fetch
|
||||
global.fetch = mockFetch
|
||||
|
||||
describe("fetchOAuthAuthServerMetadata", () => {
|
||||
|
|
@ -16,6 +17,10 @@ describe("fetchOAuthAuthServerMetadata", () => {
|
|||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
global.fetch = originalFetch
|
||||
})
|
||||
|
||||
it("returns null when resource metadata has no authorization_servers", async () => {
|
||||
;(discoverOAuthProtectedResourceMetadata as any).mockResolvedValue({
|
||||
resource: "https://example.com/",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue