test(mcp): avoid fixed oauth callback ports
This commit is contained in:
parent
22788238e2
commit
4d4eb7de28
1 changed files with 5 additions and 4 deletions
|
|
@ -82,12 +82,13 @@ describe("McpOAuthCallback.ensureRunning", () => {
|
|||
})
|
||||
|
||||
test("starts server with custom redirectUri port and path", async () => {
|
||||
await McpOAuthCallback.ensureRunning("http://127.0.0.1:18000/custom/callback")
|
||||
const port = await getFreeLoopbackPort()
|
||||
await McpOAuthCallback.ensureRunning(`http://127.0.0.1:${port}/custom/callback`)
|
||||
expect(McpOAuthCallback.isRunning()).toBe(true)
|
||||
})
|
||||
|
||||
test("stops after the callback completes", async () => {
|
||||
const redirectUri = "http://127.0.0.1:18003/custom/callback"
|
||||
const redirectUri = `http://127.0.0.1:${await getFreeLoopbackPort()}/custom/callback`
|
||||
await McpOAuthCallback.ensureRunning(redirectUri)
|
||||
const callback = McpOAuthCallback.waitForCallback("success")
|
||||
|
||||
|
|
@ -99,7 +100,7 @@ describe("McpOAuthCallback.ensureRunning", () => {
|
|||
})
|
||||
|
||||
test("escapes provider error markup in callback HTML", async () => {
|
||||
const redirectUri = "http://127.0.0.1:18001/custom/callback"
|
||||
const redirectUri = `http://127.0.0.1:${await getFreeLoopbackPort()}/custom/callback`
|
||||
await McpOAuthCallback.ensureRunning(redirectUri)
|
||||
|
||||
const error = `<script>alert("xss" & 'more')</script>`
|
||||
|
|
@ -114,7 +115,7 @@ describe("McpOAuthCallback.ensureRunning", () => {
|
|||
})
|
||||
|
||||
test("keeps normal provider errors readable", async () => {
|
||||
const redirectUri = "http://127.0.0.1:18002/custom/callback"
|
||||
const redirectUri = `http://127.0.0.1:${await getFreeLoopbackPort()}/custom/callback`
|
||||
await McpOAuthCallback.ensureRunning(redirectUri)
|
||||
|
||||
const response = await fetch(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue