Skip to content

getMockServer

getMockServer(clientType): Promise<MockServer>

Defined in: packages/testing/src/mockServer.ts:92

Get a mock server instance for the specified client type.

Reads the appropriate environment variable (MOCK_ALGOD_URL, MOCK_INDEXER_URL, or MOCK_KMD_URL) and validates that the server is reachable before returning a MockServer instance.

ClientType

The type of client to get a mock server for (‘algod’, ‘indexer’, or ‘kmd’)

Promise<MockServer>

Promise resolving to a MockServer instance

Error if the environment variable is not set or the server is not reachable

const server = await getMockServer('algod')
const client = new AlgodClient(DEFAULT_TOKEN, server.baseUrl)
// ... run tests ...