Add unit tests for stats validation - #645
Open
maugauwi-hash wants to merge 4 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement comprehensive unit tests for core contract functions across stats, types, and validation modules.
InvoiceStatus::to_u8andfrom_u8round-trip conversion for all 9 variantsget_statsreturns zero values on fresh environmentrecord_invoice_createdincrements counter correctlyassert_unique_recipientsvalidates empty recipient listsCloses #578
Closes #577
Closes #576
Closes #575