gtp-final / gradio /client /js /src /test /mock_eventsource.ts
calvesca's picture
Upload folder using huggingface_hub
0bd62e5 verified
raw
history blame contribute delete
356 Bytes
import { vi } from "vitest";
if (process.env.TEST_MODE !== "node") {
Object.defineProperty(window, "EventSource", {
writable: true,
value: vi.fn().mockImplementation(() => ({
close: vi.fn(() => {}),
addEventListener: vi.fn(),
onmessage: vi.fn((_event: MessageEvent) => {}),
onerror: vi.fn((_event: Event) => {})
}))
});
}