Skip to content

AlgorandFixture

Defined in: src/testing/types.ts:69

An Algorand automated testing fixture

beforeEach: () => Promise<void>

Defined in: src/testing/types.ts:93

Promise<void>


newScope: () => Promise<void>

Defined in: src/testing/types.ts:133

Creates a new isolated fixture scope (clean transaction logger, AlgorandClient, testAccount, etc.).

You can call this from any testing framework specific hook method to control when you want a new scope.

Promise<void>

describe('MY MODULE', () => {
const fixture = algorandFixture()
beforeEach(fixture.newScope)
test('MY TEST', async () => {
const { algorand, testAccount } = fixture.context
// Test stuff!
})
})
describe('MY MODULE', () => {
const fixture = algorandFixture()
beforeAll(fixture.newScope)
test('test1', async () => {
const { algorand, testAccount } = fixture.context
// Test stuff!
})
test('test2', async () => {
const { algorand, testAccount } = fixture.context
// algorand and testAccount are the same as in test1
})
})

get algorand(): AlgorandClient

Defined in: src/testing/types.ts:87

Retrieve an AlgorandClient loaded with the current context, including testAccount and any generated accounts loaded as signers.

AlgorandClient


get context(): AlgorandTestAutomationContext

Defined in: src/testing/types.ts:82

Retrieve the current context. Useful with destructuring.

If you haven’t called newScope then this will throw an error.

test('My test', () => {
const {algod, indexer, testAccount, ...} = fixture.context
})

AlgorandTestAutomationContext