fix: preserve ebay rate-limit fallback

This commit is contained in:
2026-04-29 14:52:08 -04:00
parent 82e7abc057
commit 5d86a4e54d
2 changed files with 18 additions and 3 deletions

View File

@@ -86,6 +86,21 @@ describe("eBay Scraper Cookie Handling", () => {
]);
});
test("returns empty results when eBay rate-limits the request", async () => {
global.fetch = mock(() =>
Promise.resolve({
ok: false,
status: 429,
headers: { get: () => "0" },
text: () => Promise.resolve(""),
}),
) as unknown as typeof fetch;
const results = await fetchEbayItems("laptop", 1000);
expect(results).toEqual([]);
});
test("deduplicates repeated item links from the same card", async () => {
global.fetch = mock(() =>
Promise.resolve({