fix(mock-client): unify mock client implementation and add pagination support (#588) - #620
Open
ravendevhub wants to merge 2 commits into
Open
fix(mock-client): unify mock client implementation and add pagination support (#588)#620ravendevhub wants to merge 2 commits into
ravendevhub wants to merge 2 commits into
Conversation
… support (Sorokit#588) - Update MOCK_HISTORY to generate 25 deterministic transaction records for multi-page pagination testing - Implement page and limit slicing in getHistory to support TransactionHistory page navigation - Scope mutable state (activeNetwork, connectedAddress) to instance closures within createMockClient to prevent cross-test contamination - Document mock strategy clearly in mock-client.ts - Add unit tests verifying pagination slicing across multiple pages and instance isolation
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
Resolves #588 by consolidating the mock client implementation in
src/lib/mock-client.ts, adding proper pagination slicing togetHistory, isolating instance state, and ensuringmain.tsxuses the canonicalcreateMockClientfactory.Changes
getHistory:MOCK_HISTORYgeneration to 25 items so multi-page pagination can be exercised.getHistoryusingpage(1-indexed) andlimit.MOCK_HISTORY.length) to enable page calculations inTransactionHistory.activeNetwork,connectedAddress) within thecreateMockClient()closure, eliminating module-level state cross-contamination between test cases.src/lib/mock-client.test.tsandsrc/lib/__tests__/mock-client.test.tscovering multi-page pagination slicing, distinct page datasets, and instance state isolation.Acceptance Criteria
mock-client.ts)mock-client.tsis actively imported and used bymain.tsxgetHistoryrespectspageandlimit(page 2 returns different results than page 1)TransactionHistoryPrev/Next pagination buttons navigate through distinct pages of data