Skip to content

Add unit tests for stats validation - #645

Open
maugauwi-hash wants to merge 4 commits into
Stellar-split:mainfrom
maugauwi-hash:add-unit-tests-for-stats-and-validation
Open

Add unit tests for stats validation#645
maugauwi-hash wants to merge 4 commits into
Stellar-split:mainfrom
maugauwi-hash:add-unit-tests-for-stats-and-validation

Conversation

@maugauwi-hash

Copy link
Copy Markdown
Contributor

Summary

Implement comprehensive unit tests for core contract functions across stats, types, and validation modules.

  • Test InvoiceStatus::to_u8 and from_u8 round-trip conversion for all 9 variants
  • Test get_stats returns zero values on fresh environment
  • Test record_invoice_created increments counter correctly
  • Test assert_unique_recipients validates empty recipient lists

Closes #578
Closes #577
Closes #576
Closes #575

Implement to_u8() and from_u8() helper methods for InvoiceStatus enum
to support compact storage encoding. Add unit test verifying all 9
InvoiceStatus variants survive round-trip conversion.

Closes Stellar-split#576
Create stats module with get_stats function and test verifying that
get_stats returns zero values on a fresh environment with no prior writes.
This ensures proper handling of uninitialized storage state.

Closes Stellar-split#577
Add test verifying that record_invoice_created increments the invoice
counter from 0 to 1 and does not affect volume, released, or refunded
counters. This catches accidental no-ops or double-increment bugs.

Closes Stellar-split#578
Create validation module with assert_unique_recipients function that
verifies recipient uniqueness. Add test for empty list boundary case
to ensure no off-by-one or early-return bugs.

Closes Stellar-split#575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant