feat(orders): add Uber Eats and Uber Rides support, fare parsing, and category resolution
This commit is contained in:
@@ -56,4 +56,22 @@ describe("Order Ingestion - Unit Tests", () => {
|
||||
expect(validRatings.includes("again")).toBe(true);
|
||||
expect(validRatings.includes(invalidRating)).toBe(false);
|
||||
});
|
||||
|
||||
it("8. Uber Eats receipt => platform 'ubereats', line_items [] (Diff 1), Uber Cash mapped", () => {
|
||||
const html = `<div>Your Friday evening order with Uber Eats</div><div>Paid with Uber Cash $43.46</div><div>Total Charged $43.46</div>`;
|
||||
const parsed = parseOrderHTML(html);
|
||||
expect(parsed.platform).toBe("ubereats");
|
||||
expect(parsed.payment.credits_amount).toBe(43.46);
|
||||
expect(parsed.line_items).toEqual([]);
|
||||
});
|
||||
|
||||
it("9. Uber Ride receipt => platform 'uber', category 'transport' (Diff 2)", () => {
|
||||
const html = `<div>Your Trip fare $84.14 · Booking Fee $1.35</div><div>Uber Cash $85.49</div><div>Total $85.49</div>`;
|
||||
const parsed = parseOrderHTML(html);
|
||||
expect(parsed.platform).toBe("uber");
|
||||
expect(parsed.payment.credits_amount).toBe(85.49);
|
||||
|
||||
const resolved = resolveMerchantCategory(parsed.merchant_name, parsed.platform);
|
||||
expect(resolved.category).toBe("transport");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user