Skip to content

algorandFixture

algorandFixture(fixtureConfig?): AlgorandFixture

Defined in: algokit-utils-ts/src/testing/fixtures/algorand-fixture.ts:60

Creates a test fixture for automated testing against Algorand. By default it tests against an environment variable specified client if the standard environment variables are specified, otherwise against a default LocalNet instance, but you can pass in an algod, indexer and/or kmd (or their respective config) if you want to test against an explicitly defined network.

AlgorandFixtureConfig

The fixture configuration

AlgorandFixture

The fixture

No config (per-test isolation)

const fixture = algorandFixture()
beforeEach(fixture.newScope)
test('My test', async () => {
const {algod, indexer, testAccount, ...} = fixture.context
// test things...
})

No config (test suite isolation)

const fixture = algorandFixture()
beforeAll(fixture.newScope)
test('My test', async () => {
const {algod, indexer, testAccount, ...} = fixture.context
// test things...
})

With config

const fixture = algorandFixture({
algod: new Algodv2('localhost', 12345, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
// ...
})
beforeEach(fixture.newScope)
test('My test', async () => {
const {algod, indexer, testAccount, ...} = fixture.context
// test things...
})

algorandFixture(fixtureConfig, config): AlgorandFixture

Defined in: algokit-utils-ts/src/testing/fixtures/algorand-fixture.ts:75

AlgorandFixtureConfig | undefined

The fixture configuration

AlgoConfig

The fixture configuration

AlgorandFixture

The fixture