Files
backnotprop__plannotator/packages/server/external-annotations.test.ts
T

19 lines
705 B
TypeScript

import { describe, expect, test, mock } from "bun:test";
import { createExternalAnnotationHandler } from "./external-annotations";
describe("external annotations SSE", () => {
test("disables idle timeout for stream requests", async () => {
const handler = createExternalAnnotationHandler("plan");
const disableIdleTimeout = mock(() => {});
const res = await handler.handle(
new Request("http://localhost/api/external-annotations/stream"),
new URL("http://localhost/api/external-annotations/stream"),
{ disableIdleTimeout },
);
expect(disableIdleTimeout).toHaveBeenCalledTimes(1);
expect(res?.headers.get("content-type")).toBe("text/event-stream");
});
});