Cosmos Query Client RPC Tests
This directory contains functional tests for the Cosmos Query Client using the Osmosis RPC endpoint.
Overview
The tests in query-client.test.ts
validate all query-client related functions by making actual RPC calls to the Osmosis mainnet RPC endpoint at https://rpc.osmosis.zone/
.
Test Categories
1. Connection Management
- Connection establishment and disconnection
- Protocol information retrieval
2. Basic Info Methods
getStatus()
- Chain status informationgetAbciInfo()
- ABCI application infogetHealth()
- Node health statusgetNetInfo()
- Network information and peers
3. Block Query Methods
getBlock()
- Retrieve block by height or latestgetBlockByHash()
- Retrieve block by hashgetBlockResults()
- Get block execution resultsgetBlockchain()
- Get range of block metadatagetHeader()
- Get block header by heightgetHeaderByHash()
- Get block header by hashgetCommit()
- Get block commit informationsearchBlocks()
- Search blocks with query
4. Transaction Query Methods
getTx()
- Get transaction by hashsearchTxs()
- Search transactions with querygetUnconfirmedTxs()
- Get unconfirmed transactionsgetNumUnconfirmedTxs()
- Get count of unconfirmed transactions
5. Chain Query Methods
getValidators()
- Get validator set with paginationgetConsensusParams()
- Get consensus parametersgetGenesis()
- Get genesis data
6. ABCI Query Methods
queryAbci()
- Execute ABCI queries
7. Error Handling
- Invalid block heights
- Invalid hashes
- Invalid pagination parameters
Running the Tests
# Run all RPC tests
npm run test:rpc
# Run tests in watch mode
npm run test:rpc:watch
# Run specific test file
npx jest --config ./jest.rpc.config.js rpc/query-client.test.ts
Test Configuration
The tests use the following configuration:
- Endpoint:
https://rpc.osmosis.zone/
- Timeout: 30 seconds per request
- Test Timeout: 60 seconds per test
Notes
- These are functional tests that make real network requests
- Tests may fail if the RPC endpoint is unavailable or rate-limited
- Some tests depend on chain state (e.g., finding transactions)
- The tests validate response structures based on Tendermint RPC v0.34 specification