improve comments

This commit is contained in:
ihrpr 2025-04-14 09:37:19 +01:00
commit 7aeb67988a
No known key found for this signature in database

View file

@ -164,7 +164,7 @@ describe("StreamableHTTPClientTransport", () => {
// We expect the 405 error to be caught and handled gracefully
// This should not throw an error that breaks the transport
await transport.start();
await expect(transport["_startOrAuthStandaloneSSE"]()).resolves.not.toThrow("Failed to open SSE stream: Method Not Allowed");
await expect(transport["_startOrAuthSse"]()).resolves.not.toThrow("Failed to open SSE stream: Method Not Allowed");
// Check that GET was attempted
expect(global.fetch).toHaveBeenCalledWith(
expect.anything(),
@ -208,7 +208,7 @@ describe("StreamableHTTPClientTransport", () => {
transport.onmessage = messageSpy;
await transport.start();
await transport["_startOrAuthStandaloneSSE"]();
await transport["_startOrAuthSse"]();
// Give time for the SSE event to be processed
await new Promise(resolve => setTimeout(resolve, 50));
@ -313,9 +313,9 @@ describe("StreamableHTTPClientTransport", () => {
await transport.start();
// Type assertion to access private method
const transportWithPrivateMethods = transport as unknown as {
_startOrAuthStandaloneSSE: (lastEventId?: string) => Promise<void>
_startOrAuthSse: (lastEventId?: string) => Promise<void>
};
await transportWithPrivateMethods._startOrAuthStandaloneSSE("test-event-id");
await transportWithPrivateMethods._startOrAuthSse("test-event-id");
// Verify fetch was called with the lastEventId header
expect(fetchSpy).toHaveBeenCalled();
@ -382,7 +382,7 @@ describe("StreamableHTTPClientTransport", () => {
await transport.start();
await transport["_startOrAuthStandaloneSSE"]();
await transport["_startOrAuthSse"]();
expect((actualReqInit.headers as Headers).get("x-custom-header")).toBe("CustomValue");
requestInit.headers["X-Custom-Header"] = "SecondCustomValue";