Skip to content

Test/dispute status transitions#516

Open
Amarjeet325 wants to merge 5 commits intoQuickLendX:mainfrom
Amarjeet325:test/dispute-status-transitions
Open

Test/dispute status transitions#516
Amarjeet325 wants to merge 5 commits intoQuickLendX:mainfrom
Amarjeet325:test/dispute-status-transitions

Conversation

@Amarjeet325
Copy link

Summary

issue #358


This PR resolves compilation failures caused by API changes in the core contract modules and updates the test suite to align with the current contract interface.

The changes restore full test compilation and ensure high coverage across dispute lifecycle, escrow queries, protocol limits, and investment queries.


Key Changes

1️⃣ API Alignment Fixes

Updated tests to match the latest contract signatures:

  • get_investment_by_invoice → replaced with get_investment
  • Removed .unwrap() where Investment is no longer Option
  • Updated get_investor_investments_paged to include status_filter: Option<InvestmentStatus>
  • Updated initialize_protocol_limits and set_protocol_limits calls to include:
    • min_bid_amount
    • min_bid_bps
  • Adjusted investor KYC approval calls to match updated function names

2️⃣ Dispute Lifecycle Coverage

Added/validated tests for:

  • None → Disputed → UnderReview → Resolved transitions
  • get_dispute_details at each state
  • get_invoice_dispute_status
  • get_invoices_by_dispute_status

Ensures correct state transitions and accurate query responses.


3️⃣ Escrow & Query Stability

Verified:

  • get_escrow_details
  • get_escrow_status
  • Correct behavior after:
    • create
    • release
    • refund
  • StorageKeyNotFound behavior for missing entries

4️⃣ Event Test Fixes

  • Added required imports:
    • soroban_sdk::testutils::Events
    • soroban_sdk::IntoVal
  • Fixed event iteration logic to match current SDK behavior

Coverage

  • Achieves ≥95% coverage for:
    • Dispute lifecycle
    • Escrow queries
    • Investment queries
    • Protocol limits
    • Status transitions

🛠 How to Run Tests

cargo clean
cargo test

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