Skip to content

test(history): cover pagination, address-change reset, loading and error in TransactionHistory (Closes #554) - #630

Open
BernardOnuh wants to merge 1 commit into
Sorokit:mainfrom
BernardOnuh:issue#554
Open

test(history): cover pagination, address-change reset, loading and error in TransactionHistory (Closes #554)#630
BernardOnuh wants to merge 1 commit into
Sorokit:mainfrom
BernardOnuh:issue#554

Conversation

@BernardOnuh

@BernardOnuh BernardOnuh commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Closes #554.

What

  • TransactionHistory.provider.test.tsx (new) — renders TransactionHistory inside a real SorokitContext via a MockSorokitProvider (no useSorokit module mock), exercising the component's actual hook path:
    • page 1 requested on first render
    • rows rendered after data resolves (N shown)
    • loading skeleton shown while the first fetch is pending
    • Prev disabled on page 1
    • Next requests page 2
    • fetch error renders the error message
    • address change resets to page 1 — the page reached for one address is never re-requested for the next
    • "Connect your wallet to view history" when no address is connected
  • TransactionHistory.test.tsx — rewrites the stale #525 regression test. Page restore via sessionStorage was removed in fc66b90 (and #578/240a4ff reset page state on address change), so the old assertion (restore "page 3 of 3") can never hold. It now asserts the live regression contract: a page reached for one address never leaks into the requests issued for a subsequent address.

Verification

  • npx vitest run src/components/TransactionHistory.test.tsx src/components/TransactionHistory.provider.test.tsx42 passed
  • npx eslint <both files> → clean
  • Repo pre-existing (unrelated, present on main): 189 failing tests across 23 files and the TransactionHistory.tsx unused useRef import lint error — untouched.

Expected behaviors verified against the component:

  • reset-to-page-1 on address change happens via the render-time reset effect (fc66b90/240a4ff)
  • page footer only shown when totalPages > 1

…nge reset, loading and error (Sorokit#554)

- Rewrite the stale (Sorokit#525) regression test: sessionStorage page-restore was
  removed (fc66b90), so it now asserts a page reached for one address never
  leaks into the next account's requests
- Add TransactionHistory.provider.test.tsx rendering the component inside a
  real SorokitContext (mock SorokitProvider), covering page-1 initial fetch,
  rendered rows, loading skeleton, Prev disabled on page 1, Next -> page 2,
  fetch-error message, address-change reset to page 1, and the
  connect-your-wallet empty state
@BernardOnuh BernardOnuh changed the title test(history): cover pagination, address-change reset, loading and error in TransactionHistory (#554) test(history): cover pagination, address-change reset, loading and error in TransactionHistory (Closes #554) Aug 29, 2026
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@BernardOnuh 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

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.

Write tests for TransactionHistory: pagination, address-change reset, loading and error states

2 participants