Skip to content

Add Unit Tests for Account Processor Filter Logic #13

@vivekpal1

Description

@vivekpal1

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

  1. Create unit tests in crates/windexer-geyser/src/processor/account.rs to cover:

    • Wildcard filters ("*")
    • Specific account filters
    • Owner filters
    • Combinations of account and owner filters
    • Edge cases, such as:
      • Empty filters
      • Invalid accounts
  2. Documentation:

    • Add comments for each test case explaining what it is testing and why.

Implementation Hints

  1. Use the Rust #[test] attribute to define unit tests.
  2. Mock any required dependencies or inputs for the process_account_update function.
  3. 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
    }
    
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions