Files
crossws/test/adapters/sse.test.ts
2024-08-09 00:50:44 +02:00

20 lines
557 B
TypeScript

import { describe, beforeAll, vi, afterAll } from "vitest";
import { wsTestsExec } from "../_utils";
import { WebSocketSSE } from "../../src/websocket/sse";
import * as undici from "undici";
globalThis.EventSource = globalThis.EventSource || (undici.EventSource as any);
describe("sse", () => {
beforeAll(() => {
vi.stubGlobal("WebSocket", WebSocketSSE);
});
afterAll(() => {
vi.unstubAllGlobals();
});
wsTestsExec("deno run --unstable-byonm -A ./sse.ts", {
adapter: "sse",
resHeaders: false, // works but not testable
});
});