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.
Parameters
Section titled “Parameters”clientType
Section titled “clientType”The type of client to get a mock server for (‘algod’, ‘indexer’, or ‘kmd’)
Returns
Section titled “Returns”Promise<MockServer>
Promise resolving to a MockServer instance
Throws
Section titled “Throws”Error if the environment variable is not set or the server is not reachable
Example
Section titled “Example”const server = await getMockServer('algod')const client = new AlgodClient(DEFAULT_TOKEN, server.baseUrl)// ... run tests ...