Skip to content

[CT-17] Write Subscription Lifecycle Test Suite (12+ tests) in Rust #1034

@devwums

Description

@devwums

Problem

The manage_hub subscription contract has no comprehensive test coverage for the full subscription lifecycle. Bugs in create, renew, expiry, and grace period logic go undetected until production.

Proposed Solution

Create contracts/cntr/tests/subscription_lifecycle_tests.rs. Write at least 12 unit tests covering: valid subscription creation, renewal before expiry, renewal during grace period, renewal after full expiry (must fail), expiry detection at exact boundary, grace period start boundary, grace period end boundary, and tier upgrade path after renewal. Import and use the modules from contracts/cntr/. All implementation must live inside contracts/cntr/.

Acceptance Criteria

  • File at contracts/cntr/tests/subscription_lifecycle_tests.rs
  • At least 12 test functions with descriptive snake_case names (e.g., test_renewal_during_grace_period)
  • Each test function has a single-line doc comment describing the scenario
  • Tests use subscription_expiry.rs and grace_period.rs peer modules
  • All tests pass with cargo test

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions