Skip to content

northersubair: event tests for edit/delete/moderate (#1427, #1428) - #1525

Merged
BigBen-7 merged 1 commit into
PinSpace-Org:mainfrom
northersubair:northersubair/contracts-event-tests
Oct 17, 2026
Merged

BigBen-7 merged 1 commit into
PinSpace-Org:mainfrom
northersubair:northersubair/contracts-event-tests

Conversation

@northersubair

Copy link
Copy Markdown
Contributor

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_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 round trip.
  • deleting_a_gist_emits_gist_deleted — asserts the topic is gist_deleted, the payload is the deleted gist id, and the gist is gone afterwards.

#1428 - hide / unhide / remove / report

  • hiding_a_gist_emits_gist_hidden
  • unhiding_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 and report_count().

Notes

  • A small last_event helper decodes the most recent event, so the assertions hold whether env.events().all() is cumulative or per-invocation.
  • All assertions are deliberately literal about topic symbols: renaming one silently breaks every downstream indexer and the API layer.
  • Vec<Val>/u64/Gist payloads are decoded via TryIntoVal, so the tests check real XDR-shaped data rather than event counts.

Validation

cargo test in contracts/: 32 passed, 0 failed (26 tests before, 6 added).

Closes #1425
Closes #1426
Closes #1427
Closes #1428

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
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@BigBen-7
BigBen-7 merged commit cf1a89f into PinSpace-Org:main Oct 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants