test(indexer): comprehensive API, SSE, and rate-limit tests - #588
Open
EmmanuelOchaje wants to merge 3 commits into
Open
test(indexer): comprehensive API, SSE, and rate-limit tests#588EmmanuelOchaje wants to merge 3 commits into
EmmanuelOchaje wants to merge 3 commits into
Conversation
…eatures Add automated tests to cover: - GET /wallets/:address/preferences falls back to empty object (default) if no preferences exist for a user (fixes Afristore#580) - SSE /wallets/:address/events only broadcasts events relevant to the specific wallet address, filtering by actor, recipient, and data fields (fixes Afristore#581) - SSE connection automatically drops and cleans up client on disconnect (fixes Afristore#582) - Rate-limit middleware correctly blocks IP after exceeding max requests per minute, with comprehensive validation of headers and limits (fixes Afristore#583) Each test suite includes: - Basic functionality tests - Edge case handling (null/undefined data) - Error scenarios (database failures) - Rate limit header validation - Per-IP tracking verification - Event filtering for different wallet roles Co-Authored-By: Open Source Contributor <opensource@afristore.io>
|
@EmmanuelOchaje is attempting to deploy a commit to the ultratechcode's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@EmmanuelOchaje Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…d fix rate-limit sequential requests
Contributor
|
Hello, kindly fix conflicts and CI failure. Thank you for your contributions. |
…kedNFT and userPreferences.upsert
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.
Summary
This PR adds comprehensive automated tests for critical indexer API, Server-Sent Events (SSE), and rate-limiting features to ensure robust marketplace functionality.
Test Coverage
Issue #580: GET /wallets/:address/preferences Fallback
{}when no preferences exist for a userIssue #581: SSE /wallets/:address/events Event Filtering
Issue #582: SSE Connection Cleanup on Disconnect
sseClientsset properly removes disconnected clientsIssue #583: Rate-Limit Middleware IP Blocking
Test Quality
Files Modified
indexer/src/__tests__/api.test.ts- Added 40+ test cases for preferences and SSEindexer/src/__tests__/rate-limit.test.ts- Enhanced with 15+ comprehensive rate limit testsCode Patterns Followed
vi.hoisted()for module-level mockingCloses #580
Closes #581
Closes #582
Closes #583