test: add callback controller specs#494
Merged
cameri merged 5 commits intocameri:mainfrom Apr 18, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds unit test coverage for the payment callback controllers to exercise previously untested validation/auth and invoice-transition branches, improving confidence and reducing regression risk in callback handling.
Changes:
- Added unit specs for LNbits, Nodeless, OpenNode, and Zebedee callback controllers.
- Covered malformed payload handling, auth/signature/guard branches, invoice state transitions, and error propagation paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/unit/controllers/callbacks/lnbits-callback-controller.spec.ts | Adds LNbits callback controller unit tests (HMAC query auth, body validation, invoice transitions, error paths). |
| test/unit/controllers/callbacks/nodeless-callback-controller.spec.ts | Adds Nodeless callback controller unit tests (signature verification, processor guard, transitions, error paths). |
| test/unit/controllers/callbacks/opennode-callback-controller.spec.ts | Adds OpenNode callback controller unit tests (payload validation, transitions, error paths). |
| test/unit/controllers/callbacks/zebedee-callback-controller.spec.ts | Adds Zebedee callback controller unit tests (IP whitelist + processor guard, payload validation, transitions, error paths). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+66
to
+67
| const makeValidQuery = (expiry = Date.now() + 60_000) => { | ||
| const expiryString = String(expiry) |
cameri
reviewed
Apr 18, 2026
| } | ||
| } | ||
|
|
||
| const makeValidQuery = (expiry = Date.now() + 60_000) => { |
Owner
There was a problem hiding this comment.
let's use Sinon fake timers if we are using Date.now() to avoid creating flaky tests
969ad58 to
1a1adb3
Compare
Collaborator
Author
|
@cameri Done! Added Sinon fake timers and a fixed expiry date to prevent test flakiness. |
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
Added unit tests for all payment callback controllers under
test/unit/controllers/callbacks/.Covered:
Related Issue
Closes #490
Motivation and Context
Callback controllers had low coverage and untested conditional logic. This PR improves confidence in callback handling and reduces regression risk.
How Has This Been Tested?
npm run test:unit -- 'test/unit/controllers/callbacks/**/*.spec.ts'npm run cover:unitResult:
583 passingScreenshots (if appropriate):
N/A
Types of changes
Checklist: