Skip to content

test(invoice): write full lifecycle integration test for invoice_contract#89

Open
teeschima wants to merge 3 commits into
TrusTrove:mainfrom
teeschima:registry
Open

test(invoice): write full lifecycle integration test for invoice_contract#89
teeschima wants to merge 3 commits into
TrusTrove:mainfrom
teeschima:registry

Conversation

@teeschima

Copy link
Copy Markdown
Contributor

Closes #7

Summary

Adds a complete end-to-end integration test that exercises the full invoice lifecycle using real (not mocked) implementations of all four contracts.

Test Flow

  1. Deploy registry, invoice, escrow, and pool contracts
  2. Wire them together (initialize each, set pool on invoice)
  3. Register issuer and buyer on the real registry contract
  4. Create invoice → assert status Created
  5. List for financing → assert status Listed
  6. Fund via pool → assert status Funded, pool stats updated
  7. Mark as shipped → assert status Active
  8. Confirm delivery (both parties) → assert status Confirmed
  9. Repay → assert status Repaid
  10. Assert pool yield increased (total_yield_distributed and LP position reflect the discount spread)

Changes

  • contracts/invoice/Cargo.toml: Add trusttrove-registry, trusttrove-escrow, trusttrove-pool as dev-dependencies
  • contracts/invoice/src/test.rs: Add test_full_lifecycle_integration with real cross-contract wiring

All 93 tests across all four contracts pass with cargo test.

Add missing tests for all error branches in registry_contract:
- test_register_buyer_duplicate: AlreadyRegistered error (TrusTrove#2)
- test_get_admin_not_found: NotFound error (TrusTrove#3)
- test_revoke_admin_not_found: NotFound error (TrusTrove#3)
- test_revoke_nonexistent_profile: NotFound error (TrusTrove#3)
- test_revoke_not_authorized: NotAuthorized error (TrusTrove#4)
- test_batch_register_issuers_no_admin: NotFound error (TrusTrove#3)

Closes TrusTrove#4
Add complete end-to-end integration test deploying all four contracts
(registry, invoice, escrow, pool) and exercising the full invoice lifecycle:

- Deploy and wire all contracts with real implementations
- Register issuer and buyer on registry
- Create invoice, list for financing, fund via pool
- Mark as shipped, confirm delivery (both parties)
- Repay and assert final status == Repaid
- Assert pool yield increased after repayment

Adds trusttrove-registry, trusttrove-escrow, trusttrove-pool as
dev-dependencies for the invoice crate.

Closes TrusTrove#7
@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@teeschima Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@teeschima

Copy link
Copy Markdown
Contributor Author

done boss

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.

test(invoice): write full lifecycle integration test for invoice_contract

1 participant