mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 09:42:44 +00:00
perf(test): cut slow monitor/subagent test overhead
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { resolveDiscordRestFetch } from "./rest-fetch.js";
|
||||
|
||||
const { undiciFetchMock, proxyAgentSpy } = vi.hoisted(() => ({
|
||||
undiciFetchMock: vi.fn(),
|
||||
@@ -31,9 +32,7 @@ describe("resolveDiscordRestFetch", () => {
|
||||
} as const;
|
||||
undiciFetchMock.mockReset().mockResolvedValue(new Response("ok", { status: 200 }));
|
||||
proxyAgentSpy.mockReset();
|
||||
|
||||
const { __testing } = await import("./provider.js");
|
||||
const fetcher = __testing.resolveDiscordRestFetch("http://proxy.test:8080", runtime);
|
||||
const fetcher = resolveDiscordRestFetch("http://proxy.test:8080", runtime);
|
||||
|
||||
await fetcher("https://discord.com/api/v10/oauth2/applications/@me");
|
||||
|
||||
@@ -54,9 +53,7 @@ describe("resolveDiscordRestFetch", () => {
|
||||
error: vi.fn(),
|
||||
exit: vi.fn(),
|
||||
} as const;
|
||||
const { __testing } = await import("./provider.js");
|
||||
|
||||
const fetcher = __testing.resolveDiscordRestFetch("bad-proxy", runtime);
|
||||
const fetcher = resolveDiscordRestFetch("bad-proxy", runtime);
|
||||
|
||||
expect(fetcher).toBe(fetch);
|
||||
expect(runtime.error).toHaveBeenCalled();
|
||||
|
||||
Reference in New Issue
Block a user