mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
perf(test): avoid proxy runtime dynamic import
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { finalizeDebugProxyCapture, initializeDebugProxyCapture } from "./runtime.js";
|
||||
|
||||
const storeState = vi.hoisted(() => {
|
||||
const events: Record<string, unknown>[] = [];
|
||||
@@ -68,14 +69,13 @@ describe("debug proxy runtime", () => {
|
||||
it("captures ambient global fetch calls when debug proxy mode is enabled", async () => {
|
||||
globalThis.fetch = vi.fn(async () => ({ status: 200 }) as Response) as typeof fetch;
|
||||
|
||||
const runtime = await import("./runtime.js");
|
||||
runtime.initializeDebugProxyCapture("test");
|
||||
initializeDebugProxyCapture("test");
|
||||
await globalThis.fetch("https://api.minimax.io/anthropic/messages", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: '{"input":"hello"}',
|
||||
});
|
||||
runtime.finalizeDebugProxyCapture();
|
||||
finalizeDebugProxyCapture();
|
||||
|
||||
const events = storeState.events.filter((event) => event.sessionId === "runtime-test-session");
|
||||
expect(events.some((event) => event.host === "api.minimax.io")).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user