Conversation
|
Usually it is better to use some testing frameworks (e.g. jest, mocha, vitest) because they support more features. They all have the similar interface, so it won't be a problem to migrate I mean, it's the matter of taste. Native tests are fine if everyone else is ok with it |
I didn't want to introduce a new framework and just followed the pattern of other tests in the project |
don't they use mocha? |
|
would it make sense to unite verification and chain-utils tests? don't get the idea about keeping them separete - both import and rely on ChainUtils class anyway |
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive test coverage for the evm-rpc package, making the existing code more robust to changes and enabling confident contributions with AI assistance. The tests use Node.js native test runner and fixture-based testing to verify block verification, chain-specific utilities, and RPC client integration across multiple EVM chains.
Changes:
- Adds test infrastructure including fixture loader, mock RPC client, and fixture capture utility
- Implements comprehensive test suites for verification functions, chain utilities, and RPC integration
- Adds test fixtures for Ethereum, Polygon, Arbitrum, and Hyperliquid chains
- Updates TypeScript configuration with
noUnusedLocalscompiler option - Adds test scripts and documentation
Reviewed changes
Copilot reviewed 14 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| evm/evm-rpc/tsconfig.json | Enables noUnusedLocals compiler option for stricter code quality |
| evm/evm-rpc/tsconfig.test.json | New TypeScript configuration for test files with noEmit option |
| evm/evm-rpc/package.json | Adds test scripts and tsx dependency for TypeScript test execution |
| evm/evm-rpc/test/README.md | Documents test execution and fixture capture procedures |
| evm/evm-rpc/test/helpers/fixture-loader.ts | Utility for loading test fixtures from JSON files |
| evm/evm-rpc/test/helpers/mock-rpc-client.ts | Mock RPC client implementation for testing |
| evm/evm-rpc/test/capture-fixtures.ts | CLI tool for capturing test fixtures from live RPC endpoints |
| evm/evm-rpc/test/verification.test.ts | Tests for block hash, transaction root, receipts root, and logs bloom verification |
| evm/evm-rpc/test/chain-utils.test.ts | Tests for chain-specific logic (Polygon state-sync, Arbitrum tx types, Hyperliquid system txs) |
| evm/evm-rpc/test/rpc.test.ts | Integration tests for RPC class including block retrieval, receipts, and verification |
| evm/evm-rpc/test/fixtures/*/block.json | Test fixture data for various chains and blocks |
| evm/evm-rpc/test/fixtures/*/receipts.json | Test receipt data for various chains and blocks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
We have Mocha alongside Vitest, and some packages use assert directly |
- 45 tests covering verification functions, chain utilities, and Rpc class - Fixture-based testing with real RPC data from Ethereum, Polygon, Arbitrum, Hyperliquid - Node.js native test framework with dynamic fixture discovery Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a27871b to
58e9ade
Compare
It makes the existing code more robust to changes and allows fearless contribution with the help of AI