test commerce.orders {
  mocks Payment = MockPayment {
    fn authorise(amount: Int) -> Effect[Result[AuthId, PaymentError]] {
      if amount > 50000 {
        Err(Declined)
      } else {
        Ok(AuthId.unsafe("MOCK-AUTH-12345678"))
      }
    }
  }

  test "small order places successfully" {
    let result <- place.call(5000)
    assert result is Ok(_)
  }

  test "large order is declined" {
    let result <- place.call(100000)
    match result {
      Err(PaymentDeclined) => { assert true }
      _                    => { assert false }
    }
  }
}
