test(ebay): add live parser suite
This commit is contained in:
1 parent
5d99e984e0
commit
ec2a26cedf
1 file changed
+20
@@ -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