mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:58:26 +00:00
test: add fetch mock helper and reaction coverage
This commit is contained in:
@@ -4,6 +4,7 @@ import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { ModelDefinitionConfig } from "../../config/types.models.js";
|
||||
import { withFetchPreconnect } from "../../test-utils/fetch-mock.js";
|
||||
import { createOpenClawCodingTools } from "../pi-tools.js";
|
||||
import { createHostSandboxFsBridge } from "../test-helpers/host-sandbox-fs-bridge.js";
|
||||
import { __testing, createImageTool, resolveImageModelConfigForTool } from "./image-tool.js";
|
||||
@@ -47,7 +48,7 @@ function stubMinimaxOkFetch() {
|
||||
base_resp: { status_code: 0, status_msg: "" },
|
||||
}),
|
||||
});
|
||||
global.fetch = fetch;
|
||||
global.fetch = withFetchPreconnect(fetch);
|
||||
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
|
||||
return fetch;
|
||||
}
|
||||
@@ -414,7 +415,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
base_resp: { status_code: 0, status_msg: "" },
|
||||
}),
|
||||
});
|
||||
global.fetch = fetch;
|
||||
global.fetch = withFetchPreconnect(fetch);
|
||||
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
|
||||
|
||||
const cfg: OpenClawConfig = {
|
||||
@@ -487,7 +488,7 @@ describe("image tool MiniMax VLM routing", () => {
|
||||
base_resp: baseResp,
|
||||
}),
|
||||
});
|
||||
global.fetch = fetch;
|
||||
global.fetch = withFetchPreconnect(fetch);
|
||||
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-minimax-vlm-"));
|
||||
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
|
||||
|
||||
Reference in New Issue
Block a user