Skip to content

feat(frontend): add test coverage and correct setup documentation - #23

Open
AnnieIj wants to merge 1 commit into
Vaulty-X:mainfrom
AnnieIj:feat/frontend-tests-and-docs
Open

feat(frontend): add test coverage and correct setup documentation#23
AnnieIj wants to merge 1 commit into
Vaulty-X:mainfrom
AnnieIj:feat/frontend-tests-and-docs

Conversation

@AnnieIj

@AnnieIj AnnieIj commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves all four acceptance criteria from issue #21.

Changes

Test coverage

  • Installed Jest 29, ts-jest, React Testing Library (React 18 compatible)
  • Added jest.config.ts and jest.setup.ts with jsdom environment and @/ path alias
  • 8 unit tests for useWallet — connect, disconnect, connecting state, error paths, fallback message, error cleared on retry
  • 8 unit tests for useVault — createVault, depositToVault, withdrawFromVault, insufficient-balance guard, multi-vault isolation
  • 12 unit tests for ApiClient — all four endpoints (initiateDeposit, initiateWithdrawal, getDepositStatus, getWithdrawalStatus), success + 4xx/5xx + network error paths
  • All 31 tests pass; npm run type-check clean

Package workflow commands

  • Added test, test:watch, test:coverage scripts to package.json
  • build, type-check were already present

Corrected startup instructions

  • Fixed npm devnpm run dev in Frontend/README.md
  • Added Available Scripts reference table

Implemented vs roadmap distinction

  • Added Implementation Status table to Frontend/README.md clearly marking each feature as ✅ Implemented, 🚧 Placeholder/Roadmap, or 🔒 Gated (Phase 3, post-audit/legal)

Bug fix

  • Fixed pre-existing type error in src/lib/stellar.ts: StellarWallet is not exported by @stellar/stellar-sdk; replaced with a local placeholder interface pending real wallet adapter integration

Files 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.ts

Closes #21

- 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
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.

[Frontend] Add test coverage and correct frontend setup documentation

1 participant