fix(core): handle partial listing data

This commit is contained in:
2026-04-28 21:34:45 -04:00
parent 7966073bf8
commit 3fe5fdb63f
10 changed files with 150 additions and 124 deletions

View File

@@ -13,7 +13,7 @@ describe("HTML Parsing Integration", () => {
// Mock fetch for all tests
global.fetch = mock(() => {
throw new Error("fetch should be mocked in individual tests");
});
}) as unknown as typeof fetch;
});
afterEach(() => {
@@ -111,7 +111,7 @@ describe("HTML Parsing Integration", () => {
`;
const results = parseSearch(mockHtml, "https://www.kijiji.ca");
expect(results[0].listingLink).toBe(
expect(results[0]?.listingLink).toBe(
"https://www.kijiji.ca/v-iphone/k0l0",
);
});
@@ -146,7 +146,7 @@ describe("HTML Parsing Integration", () => {
const results = parseSearch(mockHtml, "https://www.kijiji.ca");
expect(results).toHaveLength(1);
expect(results[0].name).toBe("iPhone 13 Pro");
expect(results[0]?.name).toBe("iPhone 13 Pro");
});
test("should return empty array for invalid HTML", () => {