Test: Component: Customer Active Deliveries (Table View) Pagination - #527
Open
Deb-Auth wants to merge 1 commit into
Open
Test: Component: Customer Active Deliveries (Table View) Pagination#527Deb-Auth wants to merge 1 commit into
Deb-Auth wants to merge 1 commit into
Conversation
|
@Deb-Auth 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! 🚀 |
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.
closes #495
Summary
Adds automated component tests covering pagination of the customer Active Deliveries table view, together with the table view itself and the pagination hook it needs.
The repository had no table view for active deliveries at the time of writing —
components/DeliveryList.tsxrenders an unpaginated card list — so there was no subject for the tests this issue asks for. This PR therefore adds the minimum implementation required to make the behaviour testable, following the project's Component -> Hook -> Service layering, then tests it thoroughly.What was added
hooks/useTablePagination.ts— a generic client-side pagination hook.features/deliveries/components/ActiveDeliveriesTable.tsx— the table view.Showing X-Y of N deliveriessummary, plus loading, error (with optional retry) and empty states.features/deliveries/components/index.tsalongsideDeliveryFilters.Test coverage
features/deliveries/components/__tests__/ActiveDeliveriesTable.test.tsx(18 tests)pageSizeis respected; the view falls back to the last valid page when the dataset shrinks beneath the current page.hooks/__tests__/useTablePagination.test.ts(10 tests)Page-size defaults, page splitting, range reporting, clamping at both ends, out-of-range
goToPagerequests, dataset shrinkage, the empty dataset, custom page sizes and a non-positive page size.Mocking of external dependencies
None is required, and that is deliberate. The table is a pure presentational component fed entirely by props, and the pagination hook is pure state — no API, wallet or WebSocket is involved on either path. That removes the main source of flakiness in this suite rather than papering over it with mocks.
Verification
npx jest features/deliveries/components/__tests__/ActiveDeliveriesTable.test.tsx hooks/__tests__/useTablePagination.test.ts— 28 tests pass.pnpm test— the full suite goes from 921 to 949 tests with no change to the set of pre-existing failures.npx eslinton every changed file — no errors.pnpm run type-check— no new errors.Note for the maintainer
CI on
mainis currently red before any of this, and these changes do not fix or worsen it:components/mobile/MobileFooter.tsxhas lost every quote character in the file (line 1 reads`use clientand line 3import React from react). This is a hard parse error that failspnpm run lint,pnpm run type-checkandpnpm run buildonmaintoday.main, largely around the wallet/Freighter mocks (useWallet,useTheme,WalletConnect,MultiSigApprovalsand related).Both look like they need a maintainer decision rather than a drive-by fix from a test PR, so I have deliberately left them untouched to keep this diff scoped to the issue.