diff --git a/src/__tests__/http-batch.test.ts b/src/__tests__/http-batch.test.ts index c5c7f33..562444a 100644 --- a/src/__tests__/http-batch.test.ts +++ b/src/__tests__/http-batch.test.ts @@ -191,46 +191,6 @@ describe("newHttpBatchRpcSession batching", () => { }); }); -// --- Symbol.dispose tests --- - -describe("newHttpBatchRpcSession Symbol.dispose", () => { - it("has Symbol.dispose property", async () => { - const { transport } = mockTransport(); - type Svc = { test(): string }; - const client = newHttpBatchRpcSession({ transport }); - - expect(typeof client[Symbol.dispose]).toBe("function"); - }); - - it("Symbol.dispose can be called without throwing", async () => { - const { transport } = mockTransport(); - type Svc = { test(): string }; - const client = newHttpBatchRpcSession({ transport }); - - expect(() => { - client[Symbol.dispose](); - }).not.toThrow(); - }); - - it("Symbol.dispose is non-enumerable", async () => { - const { transport } = mockTransport(); - type Svc = { test(): string }; - const client = newHttpBatchRpcSession({ transport }); - - expect(Object.keys(client)).toHaveLength(0); - }); - - it("spreading the proxy does not include Symbol.dispose", async () => { - const { transport } = mockTransport(); - type Svc = { test(): string }; - const client = newHttpBatchRpcSession({ transport }); - - const spread = { ...client }; - expect(Object.keys(spread)).toHaveLength(0); - expect(Symbol.dispose in spread).toBe(false); - }); -}); - // --- Server HTTP handler tests --- describe("newHttpBatchRpcResponse", () => { diff --git a/src/__tests__/workers.workers.test.ts b/src/__tests__/workers.workers.test.ts index 3a9ed6a..9c08768 100644 --- a/src/__tests__/workers.workers.test.ts +++ b/src/__tests__/workers.workers.test.ts @@ -319,26 +319,4 @@ describe("Workers runtime integration tests", () => { await expect(session.remote.add(1, 2)).rejects.toThrow(); }); }); - - describe("Symbol.dispose in Workers runtime", () => { - it("should have Symbol.dispose as a function on HTTP batch proxy", async () => { - const session = newHttpBatchRpcSession({ - url: "http://localhost:8000", - transport: async (body: string) => { - const response = await SELF.fetch("http://localhost/rpc", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body, - }); - return response.text(); - }, - }); - - // Verify Symbol.dispose is a function on the proxy - expect(typeof session[Symbol.dispose]).toBe("function"); - - // Clean up - session[Symbol.dispose](); - }); - }); }); diff --git a/src/http-batch.ts b/src/http-batch.ts index f28a78a..7d0a147 100644 --- a/src/http-batch.ts +++ b/src/http-batch.ts @@ -103,7 +103,7 @@ type PendingCall = { */ export function newHttpBatchRpcSession( options: RpcClientOptions, -): PromisifyMethods & Disposable { +): PromisifyMethods { let transport: RpcRequestFn; if (typeof options === "string") { @@ -208,9 +208,6 @@ export function newHttpBatchRpcSession( {}, { get(_target, prop) { - if (prop === Symbol.dispose) { - return () => {}; - } if (typeof prop === "symbol") return undefined; if (RESERVED_PROPS.has(prop as string)) return undefined; if (prop === "notify") return undefined; @@ -226,7 +223,7 @@ export function newHttpBatchRpcSession( }; }, }, - ) as PromisifyMethods & Disposable; + ) as PromisifyMethods; } export { RpcError } from "./core.js";