add vitest for fetchUrlContent
This commit is contained in:
parent
96c1573474
commit
48cef4256d
1 changed files with 10 additions and 0 deletions
|
|
@ -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);
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue