my_gradio / client /js /src /test /mock_eventsource.ts
xray918's picture
Upload folder using huggingface_hub
0ad74ed verified
raw
history blame contribute delete
343 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) => {})
}))
});
}