Skip to content

test(invoice-token): comprehensive test matrix validating Error::NotI… - #423

Open
neyij wants to merge 1 commit into
StellarState:devfrom
neyij:test/invoice-token-notinit
Open

test(invoice-token): comprehensive test matrix validating Error::NotI…#423
neyij wants to merge 1 commit into
StellarState:devfrom
neyij:test/invoice-token-notinit

Conversation

@neyij

@neyij neyij commented Aug 26, 2026

Copy link
Copy Markdown

…nit across all public entry points

Description

Added a comprehensive test matrix covering Error::NotInit behavior across all public entry points of the InvoiceToken contract.

The new test_uninitialized_methods_rejected test exercises the contract on a freshly deployed instance before initialize() is called. It verifies that all read and write methods reject with Error::NotInit and that failed invocations do not modify contract storage.

Closes #381

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an existing issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • ♻️ Code refactoring
  • ✅ Test addition or update
  • 🔧 Configuration change

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Testing

Added a comprehensive unit test that invokes every public InvoiceToken entry point against a freshly deployed but uninitialized contract.

How to Test

  1. Run the invoice token test suite:
    cargo test -p invoice-token
  2. Deploy a fresh InvoiceToken contract instance without calling initialize().
  3. Invoke each public read and write method and verify that every call returns Error::NotInit.
  4. Verify that failed invocations do not write or modify any contract storage keys.

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • E2E tests added/updated (if applicable)
  • Manual testing completed

Screenshots (if applicable)

Not applicable — this change adds contract unit tests and does not affect the user interface.

Additional Notes

The test covers the public read methods:

  • name
  • symbol
  • decimals
  • total_supply
  • balance
  • balance_batch
  • allowance
  • get_nonce
  • invoice_id
  • transfer_locked
  • paused

It also covers the public write methods:

  • transfer
  • transfer_from
  • approve
  • extend_allowance
  • revoke_approval
  • burn
  • burn_from
  • mint
  • mint_batch
  • set_transfer_locked
  • set_minter
  • set_decimals
  • set_paused

The test ensures that an uninitialized contract consistently rejects public operations with Error::NotInit rather than panicking or allowing unintended state changes.

For Reviewers

Please focus on:

  • Code quality and readability
  • Test coverage
  • Security implications
  • Performance impact
  • Breaking changes

In particular, verify that all public entry points are covered, the expected Error::NotInit value is asserted consistently, and failed invocations leave contract storage unchanged.

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

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.

test(invoice-token): comprehensive test matrix validating Error::NotInit across all public entry points

2 participants