Repository navigation
Conversation
PinSpace-Org#1428) Implements the two contract test issues selected for this branch. Both add coverage only: no production contract code is touched. PinSpace-Org#1427 - event tests for gist_edited and gist_deleted: - editing_a_gist_emits_gist_edited: asserts the topic is "gist_edited" and that the payload decodes to the updated Gist (so an indexer can read the new content pointer without another call) - deleting_a_gist_emits_gist_deleted: asserts the topic is "gist_deleted" and the payload is the deleted gist id, and that the gist is gone afterwards PinSpace-Org#1428 - event tests for hide, unhide, remove and report: - hiding_a_gist_emits_gist_hidden - unhiding_a_gist_emits_gist_unhidden (asserted on the last of the two moderation events) - removing_a_gist_emits_gist_removed (plus the gist is gone) - reporting_a_gist_emits_gist_reported_with_a_running_count: asserts the topic and that the published (gist_id, count) pair moves 1 -> 2 across reports, matching the return value and report_count() A small `last_event` helper decodes the most recent event, so the assertions work whether `env.events().all()` is cumulative or per-invocation. A silent rename of a topic symbol breaks every downstream indexer, so all assertions are deliberately literal. cargo test: 32 passed (26 before, 6 added). Closes PinSpace-Org#1425 Closes PinSpace-Org#1426 Closes PinSpace-Org#1427 Closes PinSpace-Org#1428
|
@northersubair 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! 🚀 |
3 tasks
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
Implements the two contract-testing issues selected for this branch: #1427 (event tests for
gist_edited/gist_deleted) and #1428 (event tests for hide/unhide/remove/report). All four issues assigned to this account are closed by this PR.Both issues are test-only — no production contract code is changed.
#1427 -
gist_editedandgist_deletedediting_a_gist_emits_gist_edited— asserts the topic isgist_editedand that the payload decodes to the updatedGist, so an indexer can read the new content pointer without another round trip.deleting_a_gist_emits_gist_deleted— asserts the topic isgist_deleted, the payload is the deleted gist id, and the gist is gone afterwards.#1428 - hide / unhide / remove / report
hiding_a_gist_emits_gist_hiddenunhiding_a_gist_emits_gist_unhidden— asserted on the last of the two moderation events, so a hide-then-unhide sequence can't be mistaken for a hide.removing_a_gist_emits_gist_removed— plus the gist is gone.reporting_a_gist_emits_gist_reported_with_a_running_count— asserts the topic and that the published(gist_id, count)pair moves 1 → 2 across reports, matching both the return value andreport_count().Notes
last_eventhelper decodes the most recent event, so the assertions hold whetherenv.events().all()is cumulative or per-invocation.Vec<Val>/u64/Gistpayloads are decoded viaTryIntoVal, so the tests check real XDR-shaped data rather than event counts.Validation
cargo testincontracts/: 32 passed, 0 failed (26 tests before, 6 added).Closes #1425
Closes #1426
Closes #1427
Closes #1428