Skip to content
IC Reactor

FakeCanister

Defined in: core/src/testing/fake-replica.ts:64

A canister the fake replica routes calls to, by method name and raw Candid.

Each handler receives the method name, the Candid-encoded argument and the call context, and returns the Candid-encoded reply. A handler that throws rejects the call as a canister trap does. A canister without query rejects every query, and one without update every update call.

createTestCanister builds one from typed handlers, which is what a test usually wants; implement this interface directly to answer with bytes the service’s Candid types would not produce.

optional query(method, arg, context): Uint8Array<ArrayBufferLike> | Promise<Uint8Array<ArrayBufferLike>>

Defined in: core/src/testing/fake-replica.ts:65

string

Uint8Array

FakeCallContext

Uint8Array<ArrayBufferLike> | Promise<Uint8Array<ArrayBufferLike>>


optional update(method, arg, context): Uint8Array<ArrayBufferLike> | Promise<Uint8Array<ArrayBufferLike>>

Defined in: core/src/testing/fake-replica.ts:70

string

Uint8Array

FakeCallContext

Uint8Array<ArrayBufferLike> | Promise<Uint8Array<ArrayBufferLike>>