Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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();
});
});
2 changes: 1 addition & 1 deletion apps/pr-reviewer/fixtures/demo-pr/shipping.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Loading