test(ebay): add live parser suite
This commit is contained in:
20
packages/core/test/live/ebay.live.test.ts
Normal file
20
packages/core/test/live/ebay.live.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import fetchEbayItems from "../../src/scrapers/ebay";
|
||||
|
||||
const LIVE_RESULT_LIMIT = 3;
|
||||
|
||||
describe("eBay live parser", () => {
|
||||
test("scrapes live search results into listing details", async () => {
|
||||
const results = await fetchEbayItems("iphone", 1, {
|
||||
maxItems: LIVE_RESULT_LIMIT,
|
||||
});
|
||||
|
||||
expect(results.length).toBeGreaterThan(0);
|
||||
for (const listing of results) {
|
||||
expect(listing.url).toStartWith("https://");
|
||||
expect(listing.title.length).toBeGreaterThan(0);
|
||||
expect(listing.listingPrice.cents).toBeGreaterThanOrEqual(0);
|
||||
expect(listing.listingPrice.currency.length).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user