---
Worked example: a checkout flow spanning two Workers. `shop.orders` authorises
payment across the wire (cross-context service call) and records the placement
in its own Durable Object agent (`Ledger`). Both the service edge and the agent
edge run end to end through the simulated wire.
---
test integration "checkout" {
  wires shop.orders, shop.payment

  test "successful orders accumulate in the ledger" {
    let first  <- shop.orders.place("acct-1", 100)
    let second <- shop.orders.place("acct-1", 200)
    match second {
      Ok(n)  => assert n == 2
      Err(_) => assert false
    }
  }

  test "a declined payment is rejected and does not record" {
    let r <- shop.orders.place("acct-2", 50000)
    match r {
      Err(Rejected) => assert true
      _             => assert false
    }
  }
}
