Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for rust crates #19

Merged
merged 6 commits into from
Jan 14, 2025
Merged

Tests for rust crates #19

merged 6 commits into from
Jan 14, 2025

Conversation

ametel01
Copy link
Collaborator

No description provided.

Add extensive test suite for Relayer including:
- Valid/invalid Ethereum address formats
- Environment variable handling
- Edge cases for hex values
- Private key validation
- Whitespace and empty string handling
- Unicode character handling
- Case sensitivity tests
- Maximum value tests

Tests ensure robust input validation and error handling
in the Relayer implementation."
Add comprehensive test suite for account.rs including:
- Basic account creation tests
- Edge cases for private key and address
- MMR proof verification tests
- Empty input validation tests
…netAccount

- Added basic unit tests for StarknetAccount creation and MMR proof verification
- Added mock tests for StarknetProvider's methods:
  - get_latest_mmr_block
  - get_min_mmr_block
  - get_mmr_state
  - get_latest_relayed_block
- Fixed Felt creation method (from_hex_str -> from_hex)
- Fixed closure ownership issues with move keyword
- Removed unused variables and imports
- Added test dependencies in Cargo.toml

The changes include:
- Basic tests for account creation with success and error cases
- Tests for MMR proof verification with empty proofs and hashes
- Mock setup for provider tests using mockall
- Fixed compiler warnings and errors
- Improved code organization and test structure
- Created tests/api_tests.rs with endpoint tests
- Moved API logic from main.rs to api.rs
- Created lib.rs to expose public API
- Added tests for verify-blocks endpoint, batch size, and app state
- Add test_get_env_var for environment variable retrieval
- Add test_get_var for type parsing from env vars
- Add test_felt_conversion for Felt type conversions
- Add test_get_or_create_db_path for database path handling
- Added mock traits for testing dependencies (DatabaseUtils, EnvVarReader, StarknetProviderFactory)
- Added test-only constructor new_with_deps for dependency injection
- Added basic unit tests:
  - Valid initialization
  - Zero polling interval error
  - Missing database file error
  - Invalid chain ID error
- Fixed visibility issues with test dependencies
- Removed unused imports and traits
@ametel01 ametel01 merged commit f865435 into main Jan 14, 2025
2 checks passed
@ametel01 ametel01 deleted the tests-for-rust-crates branch January 14, 2025 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant