Skip to content

algorandFixture

algorandFixture(fixtureConfig?): AlgorandFixture

Defined in: 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

const fixture = algorandFixture()
beforeEach(fixture.newScope)
test('My test', async () => {
const {algod, indexer, testAccount, ...} = fixture.context
// test things...
})
const fixture = algorandFixture()
beforeAll(fixture.newScope)
test('My test', async () => {
const {algod, indexer, testAccount, ...} = fixture.context
// test things...
})
const fixture = algorandFixture({
algod: new AlgodClient({ baseUrl: 'http://localhost:12345', headers: { 'X-Algo-API-Token': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' } }),
// ...
})
beforeEach(fixture.newScope)
test('My test', async () => {
const {algod, indexer, testAccount, ...} = fixture.context
// test things...
})

algorandFixture(fixtureConfig, config): AlgorandFixture

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

The fixture configuration

AlgorandFixtureConfig | undefined

AlgoConfig

The fixture configuration

AlgorandFixture

The fixture