You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: add unit tests for PaymentsService and MaintenanceWorker #424
PaymentsService and MaintenanceWorker contain critical business logic (invoice lifecycle, fee calculations, scheduled invoice polling) but have very low or zero test coverage:
Add unit tests for both modules using existing patterns (Mocha + Chai + Sinon):
payments-service.spec.ts (~29 tests):
getPendingInvoices() — delegation and error propagation
getInvoiceFromPaymentsProcessor() — string vs Invoice input handling, verifyURL logic
createInvoice() — transaction lifecycle (begin/commit/rollback), field mapping
updateInvoice() / updateInvoiceStatus() — delegation to repository
confirmInvoice() — validation guards, SATS/BTC/MSATS unit conversions, admission fee schedule filtering with pubkey whitelists, user admission on threshold met, transaction rollback on error
sendInvoiceUpdateNotification() — event construction, MSATS->SATS conversion, error logging in pipeline
maintenance-worker.spec.ts (~17 tests):
Signal handler registration
Interval scheduling
Skips processing when payments disabled
Invoice polling loop with per-invoice error resilience
Status change detection (PENDING -> COMPLETED)
amountRequested fallback for amountPaid via mergeDeepLeft
close(), onError(), onExit() behavior
Impact
Raises overall unit test coverage from ~50% to ~55% statements. Both files reach 100% statement/function coverage.
Activity
cameri commentedon Apr 18, 2026
thank you @Mahmoud-s-Khedr !