Skip to content

test(antd-table-hooks): add unit tests - #289

Merged
Komoszek merged 1 commit into
mainfrom
test/antd-table-hooks
Jun 25, 2026
Merged

Komoszek merged 1 commit into
mainfrom
test/antd-table-hooks

Conversation

@claude

@claude claude Bot commented Jun 25, 2026

Copy link
Copy Markdown

Requested by Sebastian Konowrocki · Slack thread

Before / After

@leancodepl/antd-table-hooks previously had no tests. This PR adds 49 unit tests (5 spec files) covering the package's full public API:

  • usePagination — standalone and URL/query-state modes, zero-indexed page output, default page size (100), getTablePagination config (total passthrough, size options, onChange), resetPage, and callback wiring.
  • useSorting — standalone and query-state modes, isDescending derivation, sortData.onChange updates, clearing sort on undefined, onSortUpdate callback, and resync on prop change.
  • useFilters — applyFilters composition across multiple active filters, anyFilterSet, clearing a filter, onFiltersChange payload, reset$ propagation via resetFilters, and seeding from initialValues.
  • defineFilters — static array and context-factory forms, combined Zod search-schema building, and handling of schema-less filters.
  • useTable — default/derived state from query params, onPaginationChange / onSortUpdate / onFiltersChange writers (default-value omission, param preservation, empty-value stripping, page reset on filter change), plus the buildPaginationSearchSchema, buildSortingSearchSchema, and tableSearchSchema builders.

How

Tests use @testing-library/react (renderHook/render/act) mirroring the conventions of sibling packages, run under the package's existing vitest/jsdom config. Edge cases covered: empty/null/undefined values, default-vs-non-default boundaries, multi-filter composition, and reset/cancellation flows.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DXXPnGepYUGie3we1X9PTR


Generated by Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DXXPnGepYUGie3we1X9PTR
@claude
claude Bot marked this pull request as ready for review June 25, 2026 09:35
@Komoszek
Komoszek merged commit 2b2a9b7 into main Jun 25, 2026
1 check passed
@Komoszek
Komoszek deleted the test/antd-table-hooks branch June 25, 2026 12:44
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.

2 participants