AlgorandFixture
Defined in: algokit-utils-ts/src/types/testing.ts:66
An Algorand automated testing fixture
Properties
Section titled “Properties”beforeEach
Section titled “beforeEach”beforeEach: () =>
Promise<void>
Defined in: algokit-utils-ts/src/types/testing.ts:90
Returns
Section titled “Returns”Promise<void>
newScope
Section titled “newScope”newScope: () =>
Promise<void>
Defined in: algokit-utils-ts/src/types/testing.ts:130
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.
Returns
Section titled “Returns”Promise<void>
Examples
Section titled “Examples”Jest / vitest - per test isolation (beforeEach)
describe('MY MODULE', () => { const fixture = algorandFixture() beforeEach(fixture.newScope)
test('MY TEST', async () => { const { algorand, testAccount } = fixture.context
// Test stuff! })})Jest / vitest - test suite isolation (beforeAll)
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 })})Accessors
Section titled “Accessors”algorand
Section titled “algorand”Get Signature
Section titled “Get Signature”get algorand():
AlgorandClient
Defined in: algokit-utils-ts/src/types/testing.ts:84
Retrieve an AlgorandClient loaded with the current context, including testAccount and any generated accounts loaded as signers.
Returns
Section titled “Returns”context
Section titled “context”Get Signature
Section titled “Get Signature”get context():
AlgorandTestAutomationContext
Defined in: algokit-utils-ts/src/types/testing.ts:79
Retrieve the current context. Useful with destructuring.
If you haven’t called newScope then this will throw an error.
Example
Section titled “Example”test('My test', () => { const {algod, indexer, testAccount, ...} = fixture.context})