# FakeCanister

Defined in: [core/src/testing/fake-replica.ts:64](https://github.com/B3Pay/ic-reactor/blob/f1956947ae037304fce1675a38695964c1aa9e32/packages/core/src/testing/fake-replica.ts#L64)

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](https://ic-reactor.b3pay.net/v3/libs/functions/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.

## Methods

### query()?

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

Defined in: [core/src/testing/fake-replica.ts:65](https://github.com/B3Pay/ic-reactor/blob/f1956947ae037304fce1675a38695964c1aa9e32/packages/core/src/testing/fake-replica.ts#L65)

#### Parameters

##### method

`string`

##### arg

`Uint8Array`

##### context

[`FakeCallContext`](https://ic-reactor.b3pay.net/v3/libs/interfaces/fakecallcontext/)

#### Returns

`Uint8Array`\<`ArrayBufferLike`\> \| `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>

***

### update()?

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

Defined in: [core/src/testing/fake-replica.ts:70](https://github.com/B3Pay/ic-reactor/blob/f1956947ae037304fce1675a38695964c1aa9e32/packages/core/src/testing/fake-replica.ts#L70)

#### Parameters

##### method

`string`

##### arg

`Uint8Array`

##### context

[`FakeCallContext`](https://ic-reactor.b3pay.net/v3/libs/interfaces/fakecallcontext/)

#### Returns

`Uint8Array`\<`ArrayBufferLike`\> \| `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>