The billing engine (src/lib/billing.ts, src/lib/services/orders.ts) has clear pure-ish logic worth locking in with tests: renewal invoice generation windows, suspension/termination cutoffs, proration math for upgrades, coupon scoping, multi-currency conversion and locking.
Proposal: vitest + a Postgres test container (or mocked Prisma client for the pure parts). Start with computeTotals — it's a pure function given mocked coupon/tax lookups.
The billing engine (
src/lib/billing.ts,src/lib/services/orders.ts) has clear pure-ish logic worth locking in with tests: renewal invoice generation windows, suspension/termination cutoffs, proration math for upgrades, coupon scoping, multi-currency conversion and locking.Proposal: vitest + a Postgres test container (or mocked Prisma client for the pure parts). Start with
computeTotals— it's a pure function given mocked coupon/tax lookups.