Skip to content

[contract] Add 3 Tests to liquidity_tests.rs (Part 2)Β #531

@Olowodarey

Description

@Olowodarey

πŸ“‹ Overview

Expand test coverage for the liquidity module by adding 3 new tests (Part 2 of 2).

βœ… Tasks

  • Add 3 new test functions to contract/tests/liquidity_tests.rs
  • Follow existing test patterns and helper functions
  • Verify all tests pass

πŸ§ͺ New Tests (3 total)

Test 1: Multiple LPs Fee Distribution

#[test]
fn test_multiple_lps_fee_distribution() {
    // Multiple users add liquidity
    // Swaps occur (fees collected)
    // Verify fees are distributed proportionally to LP tokens
}

Test 2: Slippage Protection

#[test]
fn test_swap_slippage_protection() {
    // Add liquidity
    // Try swap with min_amount_out too high
    // Should fail with slippage exceeded error
}

Test 3: Liquidity After Market Resolution

#[test]
fn test_liquidity_after_market_resolution() {
    // Add liquidity
    // Resolve market
    // Verify LPs can still withdraw
    // Verify no new swaps allowed
}

πŸ” Verification

  • All 3 tests written
  • All tests pass
  • Tests follow existing patterns
  • No clippy warnings

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions