mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 21:44:32 +00:00
test: add fetch mock helper and reaction coverage
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { withFetchPreconnect } from "../test-utils/fetch-mock.js";
|
||||
import { MediaAttachmentCache } from "./attachments.js";
|
||||
import { normalizeMediaUnderstandingChatType, resolveMediaUnderstandingScope } from "./scope.js";
|
||||
|
||||
@@ -28,7 +29,7 @@ describe("media understanding attachments SSRF", () => {
|
||||
|
||||
it("blocks private IP URLs before fetching", async () => {
|
||||
const fetchSpy = vi.fn();
|
||||
globalThis.fetch = fetchSpy as typeof fetch;
|
||||
globalThis.fetch = withFetchPreconnect(fetchSpy);
|
||||
|
||||
const cache = new MediaAttachmentCache([{ index: 0, url: "http://127.0.0.1/secret.jpg" }]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user