Skip to content

Fix null handling, add error redaction, price loading state, payment empty state - #1

Open
WebDeveloper-Jose wants to merge 9 commits into
developfrom
fix/issues-285-286-287-288
Open

Fix null handling, add error redaction, price loading state, payment empty state#1
WebDeveloper-Jose wants to merge 9 commits into
developfrom
fix/issues-285-286-287-288

Conversation

@WebDeveloper-Jose

Copy link
Copy Markdown
Owner

Summary

Files changed

  • MODIFIED backend/services/reputationService.js
  • MODIFIED backend/tests/reputationService.test.js
  • MODIFIED backend/api/routes/reputationRoutes.js
  • MODIFIED backend/api/controllers/reputationController.js
  • ADDED backend/tests/reputationRoutes.test.js
  • ADDED backend/services/priceOracleService.js
  • ADDED backend/tests/unit/priceOracleService.test.js
  • MODIFIED backend/api/controllers/paymentController.js
  • ADDED backend/tests/paymentController.emptyState.test.js

Note for reviewers: priceOracleService.js and its test were pulled from the canonical upstream (Stellar-Trust-Escrow/stellar-trust-escrow) since this repo's develop was missing the file entirely.

Test plan

  • All 5 target/new test files pass individually
  • No behavior change for valid inputs in reputationService.js or reputationRoutes.js

Standardized null/undefined handling using `== null` for validation and `??` for defaulting values. Updated multiple functions to use the new null handling approach.
This file contains unit tests for the priceOracleService, verifying source failover, cache behavior, and handling of stale data.
Tests error handling in reputationRoutes, ensuring specific error messages are returned and sensitive information is redacted.
Tests the empty state behavior of the listByAddress method in paymentController, ensuring it returns an explicit empty state with actionable copy when no payments exist, and correctly wraps non-empty payment lists.
Added error context handling and sensitive data redaction for reputation routes.
Updated controller methods to use next() for error handling instead of sending responses directly.
Enhance payment history response with empty state details for better user feedback.
Add tests for null/undefined handling in reputationService
This service fetches XLM/USD prices from multiple sources with failover and caching mechanisms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant