mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
19 lines
705 B
TypeScript
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");
|
|
});
|
|
});
|