Skip to content

Fix 640#805

Merged
Yunusabdul38 merged 4 commits into
Agora-Events:mainfrom
kodegreen70:fix-640
Jun 2, 2026
Merged

Fix 640#805
Yunusabdul38 merged 4 commits into
Agora-Events:mainfrom
kodegreen70:fix-640

Conversation

@kodegreen70

Copy link
Copy Markdown
Contributor

Add counter accounting tests for get_total_pro_subscriptions

Closes #640

Summary

get_total_pro_subscriptions tracks the number of active pro subscriptions but had no tests verifying the counter increments on subscribe or decrements on cancel. This PR adds three focused tests that lock in the accounting logic and guard against regressions.

Changes

contract/contracts/pro_subscription/src/test.rs

Three new tests added under the Issue #640 section:

Test What it verifies
test_total_subscriptions_increments_on_subscribe Subscribing two different organizers increments the counter to 2
test_total_subscriptions_decrements_on_cancel Subscribing then cancelling returns the counter to 0
test_total_subscriptions_no_double_count A second subscribe_pro call while active fails with SubscriptionAlreadyActive and the counter stays at 1

No production code was changed — this is a test-only addition.

How to Test

cargo test -p pro-subscription

All pre-existing tests continue to pass alongside the three new ones.

Acceptance Criteria

  • test_total_subscriptions_increments_on_subscribe exists and passes
  • test_total_subscriptions_decrements_on_cancel exists and passes
  • test_total_subscriptions_no_double_count exists and passes
  • cargo test -p pro-subscription exits with code 0
  • No new compiler warnings introduced

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

@kodegreen70 is attempting to deploy a commit to the oseh-svg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 1, 2026

Copy link
Copy Markdown

@kodegreen70 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

@OSEH-svg

OSEH-svg commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@kodegreen70 please fix merge conflicts

@Yunusabdul38 Yunusabdul38 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yunusabdul38 Yunusabdul38 merged commit 7f4f75f into Agora-Events:main Jun 2, 2026
1 of 4 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

Development

Successfully merging this pull request may close these issues.

Add get_total_pro_subscriptions snapshot test in pro_subscription

3 participants