Skip to content

fix: #536 unify mock client adapter and support pagination in getHistory - #615

Merged
k-deejah merged 2 commits into
Sorokit:mainfrom
jotel-dev:#536-mock-client.ts-is-dead-code-duplicated-by-inline-adapter-in-main.tsx-causing-diverged-mocks
Aug 29, 2026
Merged

fix: #536 unify mock client adapter and support pagination in getHistory#615
k-deejah merged 2 commits into
Sorokit:mainfrom
jotel-dev:#536-mock-client.ts-is-dead-code-duplicated-by-inline-adapter-in-main.tsx-causing-diverged-mocks

Conversation

@jotel-dev

Copy link
Copy Markdown
Contributor

Description

Resolves #536

Problem

src/lib/mock-client.ts provided createMockClient(), but src/main.tsx previously created an inline adapter with hardcoded responses and ignored pagination parameters in getHistory, causing mock divergence and broken pagination navigation in TransactionHistory.

Solution

  1. Configured src/main.tsx to use createMockClient() from src/lib/mock-client.ts as the single authoritative mock source and added code comments documenting the client strategy.
  2. Updated getHistory in src/lib/mock-client.ts to respect page and limit parameters for pagination slicing, while returning the full count as total.
  3. Expanded MOCK_HISTORY to 25 items so multi-page pagination controls (Prev/Next) function in the demo interface.
  4. Added unit tests in src/lib/mock-client.test.ts to 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)

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

…icated-by-inline-adapter-in-main.tsx-causing-diverged-mocks
@k-deejah
k-deejah merged commit 67939b9 into Sorokit:main Aug 29, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mock-client.ts is dead code duplicated by inline adapter in main.tsx causing diverged mocks

2 participants