Skip to content

test: Refactor Payjoin integration tests & helpers#1

Merged
chavic merged 3 commits intomasterfrom
test/Refactor-Payjoin-integration-tests
Apr 2, 2026
Merged

test: Refactor Payjoin integration tests & helpers#1
chavic merged 3 commits intomasterfrom
test/Refactor-Payjoin-integration-tests

Conversation

@ValeraFinebits
Copy link
Copy Markdown
Owner

Adds the missing negative integration test for Invalid invoices and cleans up the related payjoin failure coverage.

Included in this change

  • add PayjoinRequestFailsWhenInvoiceBecomesInvalid()
  • group the three related negative tests at the bottom of PayjoinPluginIntegrationTests
  • make the assertions consistent across Paid, Expired, and Invalid
  • use a race-safe helper for receiver session shutdown (close requested or already removed)

Notes
These tests currently assert the observable behavior as it exists today: the external payjoin payer times out after the invoice becomes non-payable.
Each test keeps a TODO to tighten this to an explicit fast rejection once the payjoin library supports clean in-flight session rejection.

@ValeraFinebits ValeraFinebits requested a review from chavic April 2, 2026 09:45
Copy link
Copy Markdown
Collaborator

@chavic chavic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m okay with this as a consistency refactor around the plugin’s current behavior. My main concern was making sure we weren’t accidentally turning timeout into the intended contract for already-paid, expired, and invalid invoice cases. Since those paths are still explicitly marked as TODO pending clean in-flight session closure support in the payjoin library, this makes sense to me as an intermediate step. Approving with the expectation that we’ll tighten these cases later once the underlying receiver rejection behavior is available.

@chavic chavic merged commit 4ec6361 into master Apr 2, 2026
1 check passed
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.

2 participants