test(mcp): isolate OAuth transport integration
This commit is contained in:
parent
5823deb7c8
commit
cb85fbc11e
1 changed files with 3 additions and 3 deletions
|
|
@ -1,12 +1,12 @@
|
|||
import { describe, expect, test } from "bun:test"
|
||||
import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js"
|
||||
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js"
|
||||
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
|
||||
import type {
|
||||
OAuthClientInformationMixed,
|
||||
OAuthClientMetadata,
|
||||
OAuthTokens,
|
||||
} from "@modelcontextprotocol/sdk/shared/auth.js"
|
||||
// @ts-expect-error Bun's query cache key avoids process-global module mocks from other test files.
|
||||
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js?oauth-header-isolation"
|
||||
|
||||
const canary = "resource-secret"
|
||||
const staticAuthorization = "Bearer static-resource-token"
|
||||
|
|
@ -57,7 +57,7 @@ describe("MCP OAuth header isolation", () => {
|
|||
})
|
||||
|
||||
await transport.start()
|
||||
await expect(transport.send(request())).rejects.toBeInstanceOf(UnauthorizedError)
|
||||
await expect(transport.send(request())).rejects.toThrow("Unauthorized")
|
||||
await transport.finishAuth("authorization-code")
|
||||
await transport.close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue