Skip to content

test(contracts): add Soroban testing utilities and refactor tests (#115)#122

Merged
thlpkee20-wq merged 2 commits intoRevoraOrg:masterfrom
edehvictor:test/soroban-mock-utilities
Mar 9, 2026
Merged

test(contracts): add Soroban testing utilities and refactor tests (#115)#122
thlpkee20-wq merged 2 commits intoRevoraOrg:masterfrom
edehvictor:test/soroban-mock-utilities

Conversation

@edehvictor
Copy link
Contributor

Summary

This PR abstracts repetitive Soroban testing boilerplate (Env creation, contract registration, mock auth, and address generation) into a reusable TestContext utility to improve test readability and developer experience.

Fixes #115

Changes Made

  • Created src/test_utils.rs containing the TestContext struct and helper methods.
  • Guarded the new module behind #[cfg(test)] in src/lib.rs to ensure zero bloat to the production WASM.
  • Refactored the register_offering_emits_exact_event test in src/test.rs to act as a reference implementation for the new pattern, successfully reducing boilerplate.

How to Test

  1. Pull this branch.
  2. Run cargo test to verify that all tests remain green and the newly refactored test executes perfectly using the shared context.

@edehvictor edehvictor force-pushed the test/soroban-mock-utilities branch from 7ddb289 to 32c16e5 Compare March 7, 2026 00:43
@edehvictor edehvictor force-pushed the test/soroban-mock-utilities branch from 32c16e5 to b12c14a Compare March 7, 2026 01:17
@edehvictor
Copy link
Contributor Author

Gm @thlpkee20-wq, kindly review

@thlpkee20-wq thlpkee20-wq merged commit 951a14e into RevoraOrg:master Mar 9, 2026
1 check failed
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.

Implement Soroban-Specific Mock Utilities for Easier Testing

2 participants