test: Add comprehensive unit tests for React hooks and stores#40
Open
AugistineCreates wants to merge 1 commit into
Open
test: Add comprehensive unit tests for React hooks and stores#40AugistineCreates wants to merge 1 commit into
AugistineCreates wants to merge 1 commit into
Conversation
ogazboiz
requested changes
Jun 23, 2026
ogazboiz
left a comment
Contributor
There was a problem hiding this comment.
appreciate the effort on test coverage, but this can't land as-is, it regresses the suite from 1 failing test to 12 failed suites / 49 failed tests. the jest config changes are the core problem:
- jest.config.js:10 replaces testEnvironment: "jest-environment-jsdom" with a hand-rolled transform, so every DOM test loses jsdom and now fails with "document is not defined" (Button.test.tsx, AmountInput.test.tsx, RemittanceForm.test.tsx, ErrorBoundary.test.tsx, useModalFocusTrap.test.tsx, stores.test.ts). keep testEnvironment: "jest-environment-jsdom" and drop the custom transform (next/jest already provides one).
- jest.config.js:10 transform regex '^.+\.(ts|tsx)$' has doubled backslashes so it never matches .ts/.tsx. remove the transform line entirely.
- @testing-library/react-hooks is imported by useConfirmedMutation.test.ts:2, useContractMutation.test.ts, useRepaymentOperation.test.ts:2, useTransactionPreview.test.ts but it's not in package.json and is deprecated/react-19-incompatible. rewrite those to use renderHook/act from @testing-library/react (already a dep).
- useTransactionPreview.test.ts and useContractMutation.test.ts are syntactically corrupted (quotes replaced by backslashes). rewrite the imports/string literals with proper quotes.
- jest.config.js:17-24 adds a coverageThreshold 75/80 that fails the run regardless (actual ~37%). drop it (or set to current) on a test-adding PR.
- test-utils.ts uses cacheTime (TanStack v5 renamed it gcTime).
the two files that DO run and assert real behavior (useWalletStore.test.ts, useApi.test.ts) are a good base. get the config + the broken files sorted so the suite runs green and i'll take another pass.
if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0
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.
This pr closes #6
This PR introduces comprehensive unit tests for core React hooks and custom stores to improve test coverage and ensure stability.
Changes Made
jest.config.js.package.json.useApiuseContractMutationuseConfirmedMutationuseTransactionPreviewuseRepaymentOperationuseWalletStoretest-utils.ts).