Skip to content

TestExecutionContext

Defined in: src/test-execution-context.ts:22

The TestExecutionContext class provides a context for executing tests in an Algorand environment. It manages various contexts such as contract, ledger, and transaction contexts, and provides utilities for generating values, managing accounts, and handling logic signatures.

new TestExecutionContext(defaultSenderAddress?): TestExecutionContext

Defined in: src/test-execution-context.ts:39

Creates an instance of TestExecutionContext.

bytes

The default sender address.

TestExecutionContext

get activeLogicSigArgs(): bytes[]

Defined in: src/test-execution-context.ts:120

Returns the active logic signature arguments.

bytes[]


get any(): ValueGenerator

Defined in: src/test-execution-context.ts:93

Returns the value generator.

ValueGenerator


get contract(): ContractContext

Defined in: src/test-execution-context.ts:66

Returns the contract context.

ContractContext


get defaultSender(): Account

Defined in: src/test-execution-context.ts:102

Returns the default sender account.

Account

set defaultSender(val): void

Defined in: src/test-execution-context.ts:111

Sets the default sender account.

The default sender account.

bytes | Account

void


get ledger(): LedgerContext

Defined in: src/test-execution-context.ts:75

Returns the ledger context.

LedgerContext


get templateVars(): Record<string, DeliberateAny>

Defined in: src/test-execution-context.ts:129

Returns the template variables.

Record<string, DeliberateAny>


get txn(): TransactionContext

Defined in: src/test-execution-context.ts:84

Returns the transaction context.

TransactionContext

addApplicationSpy<TContract>(spy): void

Defined in: src/test-execution-context.ts:197

Adds an application spy to the context.

TContract extends Contract

ApplicationSpy<TContract>

The application spy to add.

void


executeLogicSig(logicSig, …args): boolean | uint64

Defined in: src/test-execution-context.ts:140

Executes a logic signature with the given arguments.

LogicSig

The logic signature to execute.

bytes[]

The arguments for the logic signature.

boolean | uint64


exportLogs<T>(appId, …decoding): DecodedLogs<T>

Defined in: src/test-execution-context.ts:57

Exports logs for a given application ID and decoding.

T extends LogDecoding[]

uint64

The application ID.

T

The log decoding.

DecodedLogs<T>


getCompiledAppEntry(contract): { key: ConstructorFor<BaseContract>; value: uint64; } | undefined

Defined in: src/test-execution-context.ts:166

Gets a compiled application by contract.

ConstructorFor<BaseContract>

The contract class.

{ key: ConstructorFor<BaseContract>; value: uint64; } | undefined


getCompiledLogicSigEntry(logicsig): { key: ConstructorFor<LogicSig>; value: Account; } | undefined

Defined in: src/test-execution-context.ts:207

Gets a compiled logic signature.

ConstructorFor<LogicSig>

The logic signature class.

{ key: ConstructorFor<LogicSig>; value: Account; } | undefined


reset(): void

Defined in: src/test-execution-context.ts:230

Reinitializes the execution context, clearing all state variables and resetting internal components. Invoked between test cases to ensure isolation.

void


setCompiledApp(c, appId): void

Defined in: src/test-execution-context.ts:176

Sets a compiled application.

ConstructorFor<BaseContract>

The contract class.

uint64

The application ID.

void


setCompiledLogicSig(c, account): void

Defined in: src/test-execution-context.ts:217

Sets a compiled logic signature.

ConstructorFor<LogicSig>

The logic signature class.

Account

The account associated with the logic signature.

void


setTemplateVar(name, value, prefix?): void

Defined in: src/test-execution-context.ts:156

Sets a template variable.

string

The name of the template variable.

any

The value of the template variable.

string

The prefix for the template variable.

void