test: add comprehensive tests for invoice amendment (#135)#152
Open
edehvictor wants to merge 1 commit intoShadeProtocol:mainfrom
Open
test: add comprehensive tests for invoice amendment (#135)#152edehvictor wants to merge 1 commit intoShadeProtocol:mainfrom
edehvictor wants to merge 1 commit intoShadeProtocol:mainfrom
Conversation
Author
|
@DanielEmmanuel1 please review |
Author
|
@DanielEmmanuel1 please kindly review |
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.
Description
This PR introduces comprehensive unit tests to verify the amendment rules for invoices within the shade contract. It explicitly tests the allowed happy path for pending invoices and the restricted error path for already-paid invoices.
Type of Change
Related Issues
Fixes #135
Changes Made
contracts/shade/src/tests/test_invoice_amendment.rs.test_merchant_can_amend_pending_invoiceto verify a merchant can successfully update the amount of an invoice currently in thePendingstate.test_amend_paid_invoice_failsusing the#[should_panic]attribute to ensure that attempting to amend an invoice in thePaidstate is securely rejected by the contract.test_invoice_amendmentmodule in the parent tests module.Testing
How to reproduce:
Run the standard Soroban test command for this specific module:
cargo test --package shade test_invoice_amendmentChecklist
Screenshots (if applicable)
N/A
Additional Notes
These tests rely on the standard
Env::default().mock_all_auths()setup to cleanly bypass signature requirements and isolate the specific state-transition logic of the invoices.