Add test for get escrows#106
Open
heymide wants to merge 5 commits into
Open
Conversation
|
@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! 🚀 |
Author
|
Done, Close: #106 |
Contributor
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!