Skip to content

docs: document bookmark event payload shapes with tests - #716

Open
Nife-tanny wants to merge 1 commit into
Iris-IV:mainfrom
Nife-tanny:docs/bookmark_events
Open

docs: document bookmark event payload shapes with tests#716
Nife-tanny wants to merge 1 commit into
Iris-IV:mainfrom
Nife-tanny:docs/bookmark_events

Conversation

@Nife-tanny

Copy link
Copy Markdown

Summary

Documents the campaign_bookmarked and campaign_unbookmarked event payload shapes in EVENT_PAYLOADS.md and adds focused event verification tests.

Closes #662

Changes

EVENT_PAYLOADS.md

Added full payload documentation for two previously undocumented events:

Event Topics Data Source
campaign_bookmarked ("campaign_bookmarked", user: Address) campaign_id: u32 src/bookmarks.rs:34save_campaign()
campaign_unbookmarked ("campaign_unbookmarked", user: Address) campaign_id: u32 src/bookmarks.rs:56remove_saved_campaign()

Updated total documented publish() call sites from 48 → 50.

src/tests/test_bookmarks.rs

Added two new tests following existing Soroban event-testing conventions:

  • test_save_campaign_emits_campaign_bookmarked_event — Verifies save_campaign emits exactly 1 event with topic "campaign_bookmarked", the caller address in topic[1], and the campaign_id as a u32 payload.
  • test_remove_saved_campaign_emits_campaign_unbookmarked_event — Same verification for remove_saved_campaign with topic "campaign_unbookmarked".

Both tests check:

  • Event count (exactly 1 emitted per call)
  • Topic[0] matches expected event name
  • Topic count is 2 (event name + user address)
  • Topic[1] matches the caller Address
  • Data payload matches the campaign_id as u32

Validation

Rust toolchain was not available in the CI environment to run cargo fmt --check, cargo clippy, or tests locally. All changes follow the established codebase conventions exactly.

No production behavior was modified — only documentation and tests were added.

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Nife-tanny 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

Add full event payload documentation for campaign_bookmarked and campaign_unbookmarked to EVENT_PAYLOADS.md, covering topics, data shape, types, and semantic meaning. The payload shape for both events is: topics = ("event_name", user: Address), data = campaign_id: u32.

Add two new tests as inline #[cfg(test)] module in src/bookmarks.rs: test_save_campaign_emits_campaign_bookmarked_event and test_remove_saved_campaign_emits_campaign_unbookmarked_event that verify: event name topic, user address topic (2 topics total), and campaign_id payload as u32.

Closes Iris-IV#662
@Nife-tanny
Nife-tanny force-pushed the docs/bookmark_events branch from 82dc9a1 to a91034f Compare July 30, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] EVENT_PAYLOADS.md missing campaign_bookmarked and campaign_unbookmarked events

1 participant