test(contracts): add Soroban testing utilities and refactor tests (#115)#122
Merged
thlpkee20-wq merged 2 commits intoRevoraOrg:masterfrom Mar 9, 2026
Merged
Conversation
7ddb289 to
32c16e5
Compare
32c16e5 to
b12c14a
Compare
Contributor
Author
|
Gm @thlpkee20-wq, kindly review |
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.
Summary
This PR abstracts repetitive Soroban testing boilerplate (Env creation, contract registration, mock auth, and address generation) into a reusable
TestContextutility to improve test readability and developer experience.Fixes #115
Changes Made
src/test_utils.rscontaining theTestContextstruct and helper methods.#[cfg(test)]insrc/lib.rsto ensure zero bloat to the production WASM.register_offering_emits_exact_eventtest insrc/test.rsto act as a reference implementation for the new pattern, successfully reducing boilerplate.How to Test
cargo testto verify that all tests remain green and the newly refactored test executes perfectly using the shared context.