test: implement test helpers and initialization tests (#607)#640
Merged
yusuftomilola merged 1 commit intoDistinctCodes:mainfrom Mar 9, 2026
Merged
test: implement test helpers and initialization tests (#607)#640yusuftomilola merged 1 commit intoDistinctCodes:mainfrom
yusuftomilola merged 1 commit intoDistinctCodes:mainfrom
Conversation
|
@BigBen-7 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
yusuftomilola
approved these changes
Mar 9, 2026
Collaborator
yusuftomilola
left a comment
There was a problem hiding this comment.
Thanks for your contribution
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.
Description:
This PR establishes the foundational testing boilerplate for the
workspace_bookingsmart contract. It introduces reusable helper functions for the test suite and verifies the core one-time initialization logic of the contract.closes #607
Key Changes:
Test Module Setup: Created the
contracts/workspace_booking/src/test.rsfile with the#![cfg(test)]attribute and necessary Soroban SDK imports.Shared Helper Functions: *
setup_contract: Registers theWorkspaceBookingContractand returns its address.setup_token: Registers a mock Stellar Asset Contract, mints tokens to a recipient, and returns the token address.advance_time: A utility to fast-forward the ledger timestamp for time-based testing.Initialization Tests:
test_initialize_success: Verifies that callinginitializecorrectly sets the admin and payment token usingmock_all_auths().test_initialize_twice_fails: Ensures that attempting to initialize an already initialized contract panics with the expectedAlreadyInitialized = 3error.Acceptance Criteria Met:
cargo test -p workspace_booking test_initialize_successpasses.cargo test -p workspace_booking test_initialize_twice_failspasses.setup_contract,setup_token,advance_time) are present and functional.cargo clippy -p workspace_booking -- -D warningspasses with no warnings.