OxL Справочник OxL
РусскийEnglish

data Call

One recorded call of a mocked rpc (S.calls(.m), §18.3).

Example:

oxl✓ проверяется в CI
service Ledger {
  @public rpc note(n: i64) -> i64
}

impl Ledger {
  rpc note(n) => n
}

fn record(n: i64) -> i64 | NetError net {
  Ledger.note(n)
}

test "calls are recorded" {
  mock Ledger {
    note(n) => n + 1
  }
  let r = record(4)!
  assert_eq(r, 5)
  let calls = Ledger.calls(.note)
  assert_eq(calls.count, 1)
  assert_eq(calls[0].method, "note")
}
pub(api) data Call

С версии. 1.0.0-beta

Поля

pub(api) method: str

The rpc name.

pub(api) args: str

The arguments as text: Show of the request message.

pub(api) ctx: Ctx

The ctx the call carried: caller, metadata, idempotencyKey (a saga step sends sagaId#step), trace id.

pub(api) time: Time

When the call arrived (wall clock).

Определено в: std/core/testing.oxl:169

См. также