diff --git a/apps/pr-reviewer/fixtures/demo-pr/checkout-flow.integration.test.ts b/apps/pr-reviewer/fixtures/demo-pr/checkout-flow.integration.test.ts index 7a5dc1f..99c56a2 100644 --- a/apps/pr-reviewer/fixtures/demo-pr/checkout-flow.integration.test.ts +++ b/apps/pr-reviewer/fixtures/demo-pr/checkout-flow.integration.test.ts @@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest'; import { cartTotal } from './cart-total.ts'; import { pointsFor } from './loyalty.ts'; import { canRefund } from './refund-window.ts'; +import { shippingCost } from './shipping.ts'; const DAY_MS = 86_400_000; const settle = () => new Promise((r) => setTimeout(r, 80_000)); @@ -50,4 +51,10 @@ describe('checkout flow', () => { expect(pointsFor(total)).toBe(3); await settle(); }); + + it('charges the heavy rate for a 5 kg parcel', async () => { + expect(shippingCost(5)).toBe(12); + expect(shippingCost(5, true)).toBe(24); + await settle(); + }); }); diff --git a/apps/pr-reviewer/fixtures/demo-pr/shipping.ts b/apps/pr-reviewer/fixtures/demo-pr/shipping.ts index ef54a04..191a75c 100644 --- a/apps/pr-reviewer/fixtures/demo-pr/shipping.ts +++ b/apps/pr-reviewer/fixtures/demo-pr/shipping.ts @@ -1,4 +1,4 @@ export function shippingCost(weightKg: number, express = false): number { - const base = weightKg > 5 ? 12 : 6; + const base = weightKg >= 5 ? 12 : 6; return express ? base * 2 : base; }