fix(amazon-shopping): verify prime and delivery filters
This commit is contained in:
@@ -52,4 +52,46 @@ describe("report", () => {
|
||||
assert.match(markdown, /price missing/);
|
||||
assert.match(markdown, /https:\/\/www\.amazon\.com\/dp\/B0TEST0001/);
|
||||
});
|
||||
|
||||
it("creates a table template with constraint status markers", () => {
|
||||
const markdown = createMarkdownReport(createResponse({
|
||||
query: "sofa bed beige",
|
||||
filters: {
|
||||
includeKeywords: [],
|
||||
excludeKeywords: [],
|
||||
minRating: 4,
|
||||
minReviews: 200,
|
||||
minWidthInches: 77,
|
||||
requirePrime: true,
|
||||
deliveryBy: "tomorrow"
|
||||
},
|
||||
limit: 10,
|
||||
maxSearchPages: 2,
|
||||
filteredOutCount: 3,
|
||||
warnings: [],
|
||||
now: () => new Date("2026-04-15T00:00:00.000Z"),
|
||||
results: [{
|
||||
asin: "B0SOFABED1",
|
||||
title: "HONBAY Modular Sectional Sleeper",
|
||||
url: "https://www.amazon.com/dp/B0SOFABED1",
|
||||
price: { amount: 539.99, currency: "USD", display: "$539.99" },
|
||||
rating: 4.1,
|
||||
reviewCount: 242,
|
||||
delivery: { display: "FREE delivery Tomorrow", free: true, prime: true },
|
||||
specs: [{ name: "Item Dimensions D x W x H", value: "83.4\"D x 83.4\"W x 35\"H" }],
|
||||
bullets: [],
|
||||
matchedFilters: [],
|
||||
missingFields: ["starBreakdown"],
|
||||
extractionNotes: []
|
||||
}]
|
||||
}));
|
||||
|
||||
assert.match(markdown, /## Best Matches/);
|
||||
assert.match(markdown, /\| # \| Product \| Price \| Rating \| Reviews \| Width \| Prime \| Delivery \| Link \|/);
|
||||
assert.match(markdown, /HONBAY Modular Sectional Sleeper/);
|
||||
assert.match(markdown, /83\.4" OK/);
|
||||
assert.match(markdown, /Prime OK/);
|
||||
assert.match(markdown, /Tomorrow OK/);
|
||||
assert.match(markdown, /\[Amazon\]\(https:\/\/www\.amazon\.com\/dp\/B0SOFABED1\)/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user