test: cover admin update event contract address #253 - #626
Open
gitGolf wants to merge 1 commit into
Open
Conversation
|
@gitGolf 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! 🚀 |
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.
Overview
Adds a unit test for the admin update event emitted by
update_adminthat asserts the emitting contract address, in addition to the existing topic and data assertions. Previously the test destructured the event as(_, topics, data), so an event emitted by a different contract would have gone unnoticed.Related Issue
Closes #253
Changes
[ADD]
src/test.rstest_update_admin_emits_eventwhich asserts:env.events().all().filter_by_contract(&contract_id)and the expected event tuple contains the registeredcontract_idv1,admin,updated(matching the publish insrc/admin.rs)(old_admin, new_admin)Events::all()only returns contract events (diagnostics excluded), andfilter_by_contractkeeps only events from this contract, so a wrong emitter fails the assertion[FIX]
src/signature.rs,src/storage_types.rs>>>>>>> mainmarker and a stray}) that prevented the crate from compilingVerification Results
Note:
cargo testcannot run in this repository becausemaindoes not compile (missingmod burn;, duplicate#[contractimpl]/#[contracttype]blocks, staleCargo.lockpinning soroban-sdk 21.7.1 whileCargo.tomlrequires=27.0.3, and test modules written for the SDK 21 API). The test logic above was therefore verified against the pinned soroban-sdk 27.0.3 host in an isolated harness.