From 48cef4256d521db913bcfec600fb2a6a7eac568c Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 17 Oct 2025 10:00:17 -0700 Subject: [PATCH] add vitest for fetchUrlContent --- ...tchUrlContent.test.ts => fetchUrlContent.vitest.ts} | 10 ++++++++++ 1 file changed, 10 insertions(+) rename core/tools/implementations/{fetchUrlContent.test.ts => fetchUrlContent.vitest.ts} (89%) diff --git a/core/tools/implementations/fetchUrlContent.test.ts b/core/tools/implementations/fetchUrlContent.vitest.ts similarity index 89% rename from core/tools/implementations/fetchUrlContent.test.ts rename to core/tools/implementations/fetchUrlContent.vitest.ts index 0c8efb81b..3241bb0d2 100644 --- a/core/tools/implementations/fetchUrlContent.test.ts +++ b/core/tools/implementations/fetchUrlContent.vitest.ts @@ -89,3 +89,13 @@ test("fetchUrlContent should add truncation warning with multiple truncated item expect(result[1].content.length).toBe(DEFAULT_FETCH_URL_CHAR_LIMIT); expect(result[2].name).toBe("Truncation warning"); }); + +test("fetchUrlContent should propagate errors when URL fetch fails", async () => { + const errorMessage = "HTTP 404 Not Found"; + + (getUrlContextItems as any).mockRejectedValue(new Error(errorMessage)); + + await expect( + fetchUrlContentImpl({ url: "https://example.com/404" }, mockExtras) + ).rejects.toThrow(errorMessage); +});