wind-network/windexer
Add Unit Tests for Account Processor Filter Logic
Aperta
#13 aperta il 16 mar 2025
enhancementgood first issuetesting
Metriche repository
- Star
- (14 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
The account processor's filter logic in account.rs lacks comprehensive unit tests, making it difficult to verify its correctness for various filter configurations.
Problem
The process_account_update function contains filter logic with multiple paths based on account selection criteria. However:
- These different paths and edge cases are not fully covered by unit tests.
- Changes to the filtering logic risk breaking functionality without proper test coverage.
Required Changes
-
Create unit tests in
crates/windexer-geyser/src/processor/account.rsto cover:- Wildcard filters (
"*") - Specific account filters
- Owner filters
- Combinations of account and owner filters
- Edge cases, such as:
- Empty filters
- Invalid accounts
- Wildcard filters (
-
Documentation:
- Add comments for each test case explaining what it is testing and why.
Implementation Hints
- Use the Rust
#[test]attribute to define unit tests. - Mock any required dependencies or inputs for the
process_account_updatefunction. - Example test structure:
#[test] fn test_wildcard_filter() { let result = process_account_update("*", /* other params */); assert!(result.is_ok()); // Add additional assertions for expected behavior } - Write separate tests for each filter type and edge case.
Acceptance Criteria
- Unit tests added for all filter types (
*, specific accounts, owners, combinations). - Edge cases (e.g., empty filters, invalid accounts) are covered.
- Each test is documented with clear explanations.
- Tests pass successfully without modifying existing functionality.