fix: #536 unify mock client adapter and support pagination in getHistory - #615
Merged
Conversation
|
@jotel-dev 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! 🚀 |
…icated-by-inline-adapter-in-main.tsx-causing-diverged-mocks
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
Resolves #536
Problem
src/lib/mock-client.tsprovidedcreateMockClient(), butsrc/main.tsxpreviously created an inline adapter with hardcoded responses and ignored pagination parameters ingetHistory, causing mock divergence and broken pagination navigation inTransactionHistory.Solution
src/main.tsxto usecreateMockClient()fromsrc/lib/mock-client.tsas the single authoritative mock source and added code comments documenting the client strategy.getHistoryinsrc/lib/mock-client.tsto respectpageandlimitparameters for pagination slicing, while returning the full count astotal.MOCK_HISTORYto 25 items so multi-page pagination controls (Prev/Next) function in the demo interface.src/lib/mock-client.test.tsto verify multi-page slicing, non-overlapping slices, and total counts.Testing
npx vitest run src/lib/mock-client.test.ts src/lib/__tests__/mock-client.test.ts(All 20 tests pass)npx vitest run src/App.test.tsx(All tests pass)npm run typecheck(Passes with 0 errors)npm run build&npm run build:app(Both build successfully)