TestEnvironment
Midnight.js API Reference v2.0.2
Midnight.js API Reference / @midnight-ntwrk/midnight-js-testing / TestEnvironment
Class: abstract TestEnvironment
Abstract base class for test environments. Provides common functionality for managing test wallets and environments.
Extended byβ
Constructorsβ
Constructorβ
new TestEnvironment(
logger):TestEnvironment
Creates a new TestEnvironment instance.
Parametersβ
loggerβ
Logger
Logger instance for recording operations
Returnsβ
TestEnvironment
Methodsβ
getMidnightWalletProvider()β
getMidnightWalletProvider():
Promise<MidnightWalletProvider>
Starts a single wallet instance.
Returnsβ
Promise<MidnightWalletProvider>
A promise that resolves to the started wallet
Throwsβ
If no wallet could be started
shutdown()β
abstractshutdown(saveWalletState?):Promise<void>
Shuts down the test environment and cleans up resources.
Parametersβ
saveWalletState?β
boolean
Optional flag to save the wallet state before shutdown
Returnsβ
Promise<void>
A promise that resolves when shutdown is complete
start()β
abstractstart(maybeProofServerContainer?):Promise<EnvironmentConfiguration>
Start the test environment.
Parametersβ
maybeProofServerContainer?β
If defined, a container representing an already running proof server. If undefined, a proof server will be started automatically.
Returnsβ
Promise<EnvironmentConfiguration>
A promise that resolves to the environment configuration
startMidnightWalletProviders()β
abstractstartMidnightWalletProviders(amount?,seeds?):Promise<MidnightWalletProvider[]>
Starts multiple wallet instances.
Parametersβ
amount?β
number
Optional number of wallet instances to start
seeds?β
string[]
Optional array of seeds for the wallets
Returnsβ
Promise<MidnightWalletProvider[]>
A promise that resolves to an array of started wallets