feat(amazon-shopping): parse filters and extract search candidates
This commit is contained in:
@@ -64,6 +64,20 @@ describe("amazon-shopping CLI", () => {
|
||||
assert.equal(parseCliRequest(["usb c cable", "--json", "--markdown"]).output, "both");
|
||||
});
|
||||
|
||||
it("normalizes natural-language filters for the target request", () => {
|
||||
const request = parseCliRequest([
|
||||
"100w led bulbs that cost less than $4 each and have over 200 reviews with a review score of more than 4.5 stars",
|
||||
"--dry-run"
|
||||
]);
|
||||
|
||||
assert.equal(request.query, "100w led bulbs");
|
||||
assert.equal(request.filters.maxUnitPrice, 4);
|
||||
assert.equal(request.filters.minReviews, 200);
|
||||
assert.equal(request.filters.reviewCountComparison, "gt");
|
||||
assert.equal(request.filters.minRating, 4.5);
|
||||
assert.equal(request.filters.ratingComparison, "gt");
|
||||
});
|
||||
|
||||
it("rejects limits below one", () => {
|
||||
assert.throws(
|
||||
() => parseCliRequest(["usb c cable", "--limit", "0"]),
|
||||
|
||||
Reference in New Issue
Block a user