test(contract): add unauthorized caller revert tests for content-likes#1259
Open
wendypetersondev wants to merge 2 commits into
Open
test(contract): add unauthorized caller revert tests for content-likes#1259wendypetersondev wants to merge 2 commits into
wendypetersondev wants to merge 2 commits into
Conversation
- Add structured event types (LikedEvent, UnlikedEvent) in new events module - Emit LikedEvent when user likes content (idempotent, no duplicate events) - Emit UnlikedEvent when user unlikes content - Add 3 unit tests verifying event emission and idempotent behavior - Add 3 integration tests from external caller perspective - Events follow Soroban SDK best practices with #[contracttype] decorator - Topic constants (TOPIC_LIKED, TOPIC_UNLIKED) for indexer filtering - No breaking changes to contract API or logic - All existing tests pass, no regressions Fixes MyFanss#922
- Add 4 unit tests verifying like() and unlike() reject unauthorized callers - Add 4 integration tests from external caller perspective - Test scenarios: no auth, wrong user parameter - Verify proper error handling with try_* methods - Follow subscription contract auth_matrix.rs pattern - Use env.set_auths(&[]) to strip authorization - All tests verify Err return, not panics - No state mutation on unauthorized attempts - Total tests: 24 (10 existing + 6 event + 8 authorization) Fixes MyFanss#921
|
@wendypetersondev 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.
Implements comprehensive unauthorized caller revert tests for the content-likes Soroban contract.
Changes
Test Coverage
Security
Fixes #921