Skip to main content

EnvVarRemoteTestEnvironment

Midnight.js API Reference v2.0.2


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

Class: EnvVarRemoteTestEnvironment

Test environment that configures services using environment variables. Allows specifying custom endpoints through environment variables.

Extends​

Constructors​

Constructor​

new EnvVarRemoteTestEnvironment(logger): EnvVarRemoteTestEnvironment

Creates a new TestEnvironment instance.

Parameters​

logger​

Logger

Logger instance for recording operations

Returns​

EnvVarRemoteTestEnvironment

Inherited from​

RemoteTestEnvironment.constructor

Methods​

getEnvironmentConfiguration()​

getEnvironmentConfiguration(): EnvironmentConfiguration

Returns the configuration for environment services based on environment variables. Required environment variables:

  • MN_TEST_INDEXER: GraphQL API endpoint for the indexer
  • MN_TEST_INDEXER_WS: WebSocket endpoint for the indexer
  • MN_TEST_NODE: RPC endpoint for the blockchain node Optional environment variables:
  • MN_TEST_FAUCET: API endpoint for requesting test tokens

Returns​

EnvironmentConfiguration

Object containing service URLs from environment variables

Throws​

If any required environment variable is not set

Overrides​

RemoteTestEnvironment.getEnvironmentConfiguration


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​

RemoteTestEnvironment.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.

Inherited from​

RemoteTestEnvironment.healthCheck


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>

Inherited from​

RemoteTestEnvironment.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

Inherited from​

RemoteTestEnvironment.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

Inherited from​

RemoteTestEnvironment.startMidnightWalletProviders