test(mcp-oauth): remove redundant findAvailablePort tests (covered by port-utils)
This commit is contained in:
parent
2048a877f7
commit
e031695975
@ -1,38 +1,8 @@
|
|||||||
import { afterEach, describe, expect, it } from "bun:test"
|
import { afterEach, describe, expect, it } from "bun:test"
|
||||||
import { findAvailablePort, startCallbackServer, type CallbackServer } from "./callback-server"
|
import { startCallbackServer, type CallbackServer } from "./callback-server"
|
||||||
|
|
||||||
const nativeFetch = Bun.fetch.bind(Bun)
|
const nativeFetch = Bun.fetch.bind(Bun)
|
||||||
|
|
||||||
describe("findAvailablePort", () => {
|
|
||||||
it("returns the start port when it is available", async () => {
|
|
||||||
// given
|
|
||||||
const startPort = 19877
|
|
||||||
|
|
||||||
// when
|
|
||||||
const port = await findAvailablePort(startPort)
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(port).toBeGreaterThanOrEqual(startPort)
|
|
||||||
expect(port).toBeLessThan(startPort + 20)
|
|
||||||
})
|
|
||||||
|
|
||||||
it("skips busy ports and returns next available", async () => {
|
|
||||||
// given
|
|
||||||
const blocker = Bun.serve({
|
|
||||||
port: 19877,
|
|
||||||
hostname: "127.0.0.1",
|
|
||||||
fetch: () => new Response(),
|
|
||||||
})
|
|
||||||
|
|
||||||
// when
|
|
||||||
const port = await findAvailablePort(19877)
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(port).toBeGreaterThan(19877)
|
|
||||||
blocker.stop(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("startCallbackServer", () => {
|
describe("startCallbackServer", () => {
|
||||||
let server: CallbackServer | null = null
|
let server: CallbackServer | null = null
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user