Skip to main content

RemoteTestEnvironment

Midnight.js API Reference v2.0.2


Midnight.js API Reference / @midnight-ntwrk/midnight-js-testing / RemoteTestEnvironment

Class: abstract RemoteTestEnvironment

Base class for remote test environments that connect to external network services. Provides functionality for managing walletProviders and a proof server container.

Extends​

Extended by​

Constructors​

Constructor​

new RemoteTestEnvironment(logger): RemoteTestEnvironment

Creates a new TestEnvironment instance.

Parameters​

logger​

Logger

Logger instance for recording operations

Returns​

RemoteTestEnvironment

Inherited from​

TestEnvironment.constructor

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

Inherited from​

TestEnvironment.getMidnightWalletProvider


healthCheck()​

healthCheck(): Promise<void>

Performs a health check for the environment. Checks the health of the node, indexer, and optionally the faucet services.

Returns​

Promise<void>

A promise that resolves when the health check is complete.


shutdown()​

shutdown(saveWalletState?): Promise<void>

Shuts down the test environment by closing all walletProviders and stopping the proof server.

Parameters​

saveWalletState?​

boolean

Returns​

Promise<void>

Overrides​

TestEnvironment.shutdown


start()​

start(maybeProofServerContainer?): Promise<EnvironmentConfiguration>

Starts the test environment by initializing the proof server and environment configuration.

Parameters​

maybeProofServerContainer?​

ProofServerContainer

Optional proof server container to use instead of creating a new one

Returns​

Promise<EnvironmentConfiguration>

The environment configuration

Overrides​

TestEnvironment.start


startMidnightWalletProviders()​

startMidnightWalletProviders(amount, seeds): Promise<MidnightWalletProvider[]>

Creates and starts the specified number of wallet providers.

Parameters​

amount​

number = 1

seeds​

undefined | string[]

Returns​

Promise<MidnightWalletProvider[]>

Array of started wallet providers

Overrides​

TestEnvironment.startMidnightWalletProviders