test(orders): pass the cart stub the OrdersService constructor now takes

OrdersService gained a CartService dependency (createOrder empties the cart
once the order is placed), so both specs failed to compile with TS2554 and
their suites never ran. Adds a clearForCustomer stub.

Full suite: 52/52 suites, 547/547 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mahmood
2026-11-26 15:20:33 +03:30
co-authored by Claude Opus 5.5
parent 14db0b0a80
commit a085c279f8
2 changed files with 12 additions and 1 deletions
@@ -163,6 +163,8 @@ function world(opts: { customerPercent: string; variants: Variant[]; promotions?
{ orderStatusReached: jest.fn(), orderCancelled: jest.fn() } as never,
wage,
{ send: jest.fn(async () => ({ ok: true })) } as never,
// createOrder empties the customer's cart once the order is placed.
{ clearForCustomer: jest.fn(async () => undefined) } as never,
);
return { db, customer, entries, orders, ledger, orderService };
@@ -103,7 +103,16 @@ function world(opts: { status: OrderStatus; salesAgentId?: string | null; blocke
orderCancelled: jest.fn(async () => undefined),
};
const ledger = new LedgerService(prisma as never);
const service = new OrdersService(prisma as never, {} as never, ledger, accounting as never, {} as never, { send: jest.fn() } as never);
const service = new OrdersService(
prisma as never,
{} as never,
ledger,
accounting as never,
{} as never,
{ send: jest.fn() } as never,
// createOrder empties the customer's cart once the order is placed.
{ clearForCustomer: jest.fn(async () => undefined) } as never,
);
/** The debt a delivered order carries right now (what updateRemain would give). */
const owed = () => ({ gold: customer.goldDebtGrams, rial: customer.fiatDebtRial });