Skip to content

Fix 632#806

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

Fix 632#806
Yunusabdul38 merged 5 commits into
Agora-Events:mainfrom
kodegreen70:fix-632

Conversation

@kodegreen70
Copy link
Copy Markdown
Contributor

Add cancel_subscription test coverage

Closes #632

Summary

cancel_subscription is an admin-only function with several distinct code paths — subscription not found, successful cancellation, and unauthorized caller — none of which had dedicated tests. This PR adds the three missing cases to lock in the existing behaviour before any future changes.

Changes

contract/contracts/pro_subscription/src/test.rs

Three new tests added under the Issue #632 section:

Test What it verifies
test_cancel_subscription_success Subscribe, cancel, assert is_pro_member returns false and the stored record has is_active = false
test_cancel_subscription_not_found Calling cancel_subscription for an address that never subscribed returns SubscriptionNotFound
test_cancel_subscription_unauthorized A non-admin caller causes an auth panic (#[should_panic]), matching the pattern used by other unauthorized tests in the suite

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_cancel_subscription_success exists and passes
  • test_cancel_subscription_not_found exists and passes
  • test_cancel_subscription_unauthorized exists and passes
  • cargo test -p pro-subscription exits with code 0
  • No new compiler warnings introduced

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@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
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@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
Copy link
Copy Markdown
Contributor

OSEH-svg commented Jun 1, 2026

@kodegreen70 please fix merge conflict

Copy link
Copy Markdown
Contributor

@Yunusabdul38 Yunusabdul38 left a comment

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 46f7deb 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 unit tests for pro_subscription::cancel_subscription

3 participants