# TestCanisterHandler

> **TestCanisterHandler**\<`A`, `M`\> = (`args`, `context`) => [`ActorMethodReturnType`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/actormethodreturntype/)\<`A`\[`M`\]\> \| `Promise`\<[`ActorMethodReturnType`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/actormethodreturntype/)\<`A`\[`M`\]\>\>

Defined in: [core/src/testing/test-canister.ts:26](https://github.com/B3Pay/ic-reactor/blob/f1956947ae037304fce1675a38695964c1aa9e32/packages/core/src/testing/test-canister.ts#L26)

Answers one method of a test canister: it receives the method's decoded
Candid arguments as a tuple, as `callMethod` takes them, and returns the
method's Candid result, or a promise of it. A handler that throws rejects
the call as a canister trap does.

The arguments and the result are the raw Candid values the canister sees
(`bigint`, `Principal`, `[] | [T]` for an `opt`), whichever reactor the
test calls through.

## Type Parameters

### A

`A`

### M

`M` *extends* [`FunctionName`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/functionname/)\<`A`\>

## Parameters

### args

[`ActorMethodParameters`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/actormethodparameters/)\<`A`\[`M`\]\>

### context

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

## Returns

[`ActorMethodReturnType`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/actormethodreturntype/)\<`A`\[`M`\]\> \| `Promise`\<[`ActorMethodReturnType`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/actormethodreturntype/)\<`A`\[`M`\]\>\>