🔖 Title
Add unit tests for `TransactionStatusCheckerProcessor` and `LoanPaymentReminderProcessor`
📄 Description
`test/unit/jobs/` contains only `blockchain-indexer.processor.spec.ts`. Two other job processors with significant business logic are completely untested:
`TransactionStatusCheckerProcessor` — critical paths with no test coverage:
- Horizon retry with exponential back-off (transient errors silently swallowed if retries exhausted)
- `parseTransactionMetadata()` — parses raw Stellar XDR to extract `loanId` and `amount` from `invokeHostFunction` operations; a parsing bug here silently misapplies payments to wrong loans
- `activatePendingLoan()` and `applyLoanRepayment()` — DB mutations triggered by XDR parse result
- Notification creation on loan activation and repayment
- `cleanupOldTransactions()` scheduled deletion
`LoanPaymentReminderProcessor` — date-boundary logic with no test coverage:
- 3-day reminder window calculation
- 1-day reminder window calculation
- Overdue detection
- Duplicate notification skip (same loan, same window, reminder already sent)
✅ Tasks to complete
📚 Documentation/context for AI
(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs
Relevant files:
- `src/jobs/transaction-status-checker/transaction-status-checker.processor.ts`
- `src/jobs/loan-payment-reminder/loan-payment-reminder.processor.ts`
- `test/unit/jobs/blockchain-indexer.processor.spec.ts` — use as pattern reference
- `test/fixtures/`
- `test/helpers/`
🗒️ Additional notes
- Use `jest.useFakeTimers()` for date-sensitive tests in the reminder processor to control `new Date()` without flakiness
- XDR fixtures can be generated via `StellarSdk.xdr` in a test setup script — commit the base64 string directly to `test/fixtures/` to avoid SDK calls in tests
- BullMQ `Job` mock only needs `id`, `name`, and `data` fields for these processors
- The `parseTransactionMetadata` extraction should not change public API — it is an internal refactor for testability only
🔖 Title
Add unit tests for `TransactionStatusCheckerProcessor` and `LoanPaymentReminderProcessor`
📄 Description
`test/unit/jobs/` contains only `blockchain-indexer.processor.spec.ts`. Two other job processors with significant business logic are completely untested:
`TransactionStatusCheckerProcessor` — critical paths with no test coverage:
`LoanPaymentReminderProcessor` — date-boundary logic with no test coverage:
✅ Tasks to complete
📚 Documentation/context for AI
(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs
Relevant files:
🗒️ Additional notes