Skip to content

test(invoice-token): add test suite for mint, mint_batch, and TransferLocked error paths - #312

Open
SMOGZ6783 wants to merge 1 commit into
StellarState:devfrom
SMOGZ6783:feature/issue-implementation
Open

test(invoice-token): add test suite for mint, mint_batch, and TransferLocked error paths#312
SMOGZ6783 wants to merge 1 commit into
StellarState:devfrom
SMOGZ6783:feature/issue-implementation

Conversation

@SMOGZ6783

Copy link
Copy Markdown

Summary

Adds test coverage in contracts/invoice-token/src/test.rs for error paths that were not previously exercised: mint, mint_batch, and an explicit assertion on the TransferLocked error variant.

Closes #169

New tests added

  • test_mint_unauthorized_fails — non-admin/non-minter caller rejected
  • test_mint_zero_amount_rejected / test_mint_negative_amount_rejectedInvalidAmount
  • test_mint_while_paused_failsPaused
  • test_mint_by_admin_succeeds — admin can mint (not just the designated minter)
  • test_mint_overflow_rejectedOverflow on balance overflow
  • test_mint_batch_length_mismatch_rejectedBatchLengthMismatch
  • test_mint_batch_unauthorized_failsUnauthorized
  • test_mint_batch_while_paused_failsPaused
  • test_mint_batch_succeeds_and_preserves_order — state persistence across batch mint
  • test_transfer_fails_with_transfer_locked_error — explicit TransferLocked assertion

Testing

  • cargo fmt clean
  • cargo clippy --all-targets -- -D warnings clean
  • cargo test --all passes, including all pre-existing tests
  • New tests assert both the returned Error variant and resulting state (balance/total_supply) persistence

Acceptance criteria

  • ✅ All implementation tasks completed
  • ✅ Compiles without warnings or errors
  • ✅ All existing tests continue to pass
  • ✅ New unit tests cover previously untested error/edge paths
  • ✅ PR targets dev
  • cargo fmt and cargo clippy clean

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@SMOGZ6783 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.

[TESTING] Add Test Suite for Custom Payment Token Contract Errors

1 participant