Skip to content

Add test for get escrows#106

Open
heymide wants to merge 5 commits into
JSE-ORG:mainfrom
heymide:add-test-for-get-escrows
Open

Add test for get escrows#106
heymide wants to merge 5 commits into
JSE-ORG:mainfrom
heymide:add-test-for-get-escrows

Conversation

@heymide
Copy link
Copy Markdown

@heymide heymide commented May 26, 2026

Close: #49
I have successfully added the get_escrows_by_vendor function and verified it with a robust set of unit tests matching all acceptance criteria.

Summary of Changes
Contract Implementation (contracts/escrow/src/lib.rs):

Added a new VendorEscrows(Address) entry to the DataKey enum to map vendor (seller) addresses to their associated escrow IDs.
Updated create_escrow to push newly created escrow IDs into the vendor's tracking vector (Vec) within the instance storage.
Added the get_escrows_by_vendor read-only function, which retrieves the list of escrow IDs for a given vendor address, returning an empty vector if none exist.
Unit Tests (contracts/escrow/src/test.rs):

Added test_get_escrows_by_vendor_returns_correct_ids: Verifies that when multiple escrows are created by different vendors, querying for a vendor returns their exact list of escrow IDs in chronological order.
Added test_get_escrows_by_vendor_ids_persist_after_settlement: Verifies that escrow IDs persist for a vendor even after their escrows are funded and completed/refunded.
Added test_get_escrows_by_vendor_returns_empty_for_unknown_vendor: Verifies that a query for a vendor with no active escrows returns an empty vector (zero records).
All 21 contract tests compiled successfully and passed!

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 26, 2026

@heymide 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

@heymide
Copy link
Copy Markdown
Author

heymide commented May 26, 2026

Done, Close: #106

@JSE19
Copy link
Copy Markdown
Contributor

JSE19 commented May 27, 2026

Please resolve merge conflict and try again

…ution

- Kept the efficient VendorEscrows tracking from add-test-for-get-escrows branch
- Integrated both get_escrows_by_vendor test implementations
- Preserved all non-USDC token compatibility tests
- Resolved test snapshot conflicts
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.

Add test for get_escrows_by_vendor returns correct IDs

3 participants