Skip to content

test: add unit tests for convertToArrayPayload utility#12967

Merged
bluebill1049 merged 3 commits intoreact-hook-form:masterfrom
kamja44:test/add-util-test-for-convertToArrayPayload
Jul 25, 2025
Merged

test: add unit tests for convertToArrayPayload utility#12967
bluebill1049 merged 3 commits intoreact-hook-form:masterfrom
kamja44:test/add-util-test-for-convertToArrayPayload

Conversation

@kamja44
Copy link
Copy Markdown
Contributor

@kamja44 kamja44 commented Jul 16, 2025

Add unit tests for convertToArrayPayload to cover array and non-array inputs

This PR adds unit tests for the convertToArrayPayload utility function.

Covers behavior for both array and non-array inputs

Ensures that:

  • If the input is already an array, it is returned as-is
  • If the input is not an array (e.g., number, string, object), it is wrapped into an array

Uses toStrictEqual assertions to ensure both structure and reference correctness

This improves confidence in the behavior of this small but widely used utility and guards against regressions during refactoring. The tests are type-agnostic and work across primitive and object types.

@bluebill1049 bluebill1049 merged commit 642145a into react-hook-form:master Jul 25, 2025
6 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.

2 participants