feat(frontend): add test coverage and correct setup documentation - #23
Open
AnnieIj wants to merge 1 commit into
Open
feat(frontend): add test coverage and correct setup documentation#23AnnieIj wants to merge 1 commit into
AnnieIj wants to merge 1 commit into
Conversation
- Install Jest, ts-jest, React Testing Library for Next.js/React 18 - Add jest.config.ts and jest.setup.ts with jsdom environment and @/ alias - Add test, test:watch, test:coverage scripts to package.json - Write 8 unit tests for useWallet hook (connect, disconnect, error paths) - Write 8 unit tests for useVault hook (create, deposit, withdraw, edge cases) - Write 12 unit tests for ApiClient (all endpoints, success + error states) - Fix README: npm dev -> npm run dev - Add Available Scripts table to README - Add Implementation Status table distinguishing implemented vs roadmap/gated features - Fix pre-existing type error in stellar.ts (StellarWallet not exported by SDK) All 31 tests pass, type-check clean. Closes Vaulty-X#21
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.
Summary
Resolves all four acceptance criteria from issue #21.
Changes
Test coverage
jest.config.tsandjest.setup.tswith jsdom environment and@/path aliasuseWallet— connect, disconnect, connecting state, error paths, fallback message, error cleared on retryuseVault— createVault, depositToVault, withdrawFromVault, insufficient-balance guard, multi-vault isolationApiClient— all four endpoints (initiateDeposit, initiateWithdrawal, getDepositStatus, getWithdrawalStatus), success + 4xx/5xx + network error pathsnpm run type-checkcleanPackage workflow commands
test,test:watch,test:coveragescripts topackage.jsonbuild,type-checkwere already presentCorrected startup instructions
npm dev→npm run devinFrontend/README.mdImplemented vs roadmap distinction
Frontend/README.mdclearly marking each feature as ✅ Implemented, 🚧 Placeholder/Roadmap, or 🔒 Gated (Phase 3, post-audit/legal)Bug fix
src/lib/stellar.ts:StellarWalletis not exported by@stellar/stellar-sdk; replaced with a local placeholder interface pending real wallet adapter integrationFiles changed
Frontend/package.json,Frontend/package-lock.json,Frontend/jest.config.ts,Frontend/jest.setup.ts,Frontend/README.md,Frontend/src/lib/stellar.ts,Frontend/src/hooks/__tests__/useWallet.test.ts,Frontend/src/hooks/__tests__/useVault.test.ts,Frontend/src/lib/__tests__/api.test.tsCloses #21