Skip to content

test(invoice-token): add test for uninitialized method call rejections - #311

Open
Horlarmmy wants to merge 3 commits into
StellarState:devfrom
Horlarmmy:feature/issue-implementation
Open

test(invoice-token): add test for uninitialized method call rejections#311
Horlarmmy wants to merge 3 commits into
StellarState:devfrom
Horlarmmy:feature/issue-implementation

Conversation

@Horlarmmy

Copy link
Copy Markdown

[TESTING] Add Test Case for Uninitialized Contract Method Call Rejections

Closes #156

Summary

Adds a single comprehensive test (test_uninitialized_methods_rejected) that
validates all 30+ public methods of the InvoiceToken contract return
Error::NotInit when invoked on an uninitialized contract instance.

Changes

  • contracts/invoice-token/src/test.rs — added test_uninitialized_methods_rejected:
    • Calls every public method on a registered-but-uninitialized contract
    • Asserts each returns Err(Ok(Error::NotInit))
    • Calls initialize() at the end to verify storage was not written
      by the rejected calls (proves state persistence)

Verification

  • cargo test --package invoice-token — 70/70 tests pass
  • cargo fmt --all -- --check — clean
  • cargo clippy --package invoice-token --all-targets --all-features -- -D warnings — clean

Note: 2 pre-existing test failures in invoice-escrow
(test_set_buyer_whitelisted_requires_admin_auth,
test_set_whitelist_enabled_requires_admin_auth) are unrelated
to this change and fail on the base dev branch as well.

Checklist

  • Implementation tasks completed cleanly
  • Code compiles without warnings or errors
  • All existing tests continue to pass
  • New unit tests cover all modified code paths
  • PR targets dev branch
  • Code follows project style guidelines (cargo fmt + cargo clippy)

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Horlarmmy 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 test_uninitialized_methods_rejected to invoice-token (Issue StellarState#156)
- Fix invoice-escrow tests: use &0 fee, purchase_price = amount, invoke_contract for whitelist auth tests
- Add EscrowPartiallyFunded = 24 error variant
- Fix payment-distributor: FeeTier struct, StorageKey variants, error variants, refund_distributed call, deduplicate MAX_FEE_BPS
- Update and add test snapshots
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.

[TESTING] Add Test Case for Uninitialized Contract Method Call Rejections

1 participant