pnpm installpnpm testAll 210+ tests should pass ✅
# Run all tests once
pnpm test
# Run tests in watch mode (auto-rerun on file changes)
pnpm test:watch
# Run specific test file
pnpm test NetworkBadge.test.tsx
# Generate coverage report
pnpm test:coverage
# Run tests with verbose output
pnpm test --verbose
# Clear Jest cache
pnpm test --clearCachesrc/components/wallet/__tests__/
├── NetworkBadge.test.tsx # 80+ tests for network badge
├── StatusIndicator.test.tsx # 80+ tests for status indicator
└── WalletTable.test.tsx # 50+ integration tests
- ✅ Renders testnet and mainnet badges
- ✅ Applies correct colors and styles
- ✅ Handles dark mode
- ✅ Merges custom classes
- ✅ Validates invalid inputs gracefully
- ✅ Accessible and semantic
- ✅ Renders all status types (active, pending, inactive)
- ✅ Shows animated dot for pending status
- ✅ Applies correct colors per status
- ✅ Handles dark mode
- ✅ Merges custom classes
- ✅ Validates invalid inputs gracefully
- ✅ Accessible and semantic
- ✅ Displays wallet data in table format
- ✅ Integrates NetworkBadge correctly
- ✅ Integrates StatusIndicator correctly
- ✅ Handles empty wallet list
- ✅ Responsive design (mobile, tablet, desktop)
- ✅ Displays balance and address correctly
- ✅ Accessible table structure
Now gracefully handles invalid network values by defaulting to mainnet.
Now gracefully handles invalid status values by defaulting to inactive.
Generate a detailed coverage report:
pnpm test:coverageThis creates a coverage/ directory with HTML reports showing:
- Line coverage
- Branch coverage
- Function coverage
- Statement coverage
Open coverage/lcov-report/index.html in your browser to view.
pnpm test -- --testNamePattern="should render testnet badge"pnpm test NetworkBadge.test.tsxnode --inspect-brk node_modules/.bin/jest --runInBandThen open chrome://inspect in Chrome DevTools.
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- run: pnpm install
- run: pnpm test --coverage
- run: pnpm buildpnpm installIncrease timeout in jest.config.ts:
testTimeout: 10000Verify jest.config.ts has correct moduleNameMapper:
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
}Ensure Tailwind CSS classes are correct and class-variance-authority is installed.
- Run tests:
pnpm test - Check coverage:
pnpm test:coverage - Watch mode:
pnpm test:watch(for development) - Read docs: See
TEST_DOCUMENTATION.mdfor detailed info - Integrate CI: Add test commands to your CI pipeline
- Jest Docs
- React Testing Library
- TEST_DOCUMENTATION.md - Comprehensive guide
- IMPLEMENTATION_SUMMARY.md - Implementation details
Refer to:
TEST_DOCUMENTATION.md- Detailed test documentationIMPLEMENTATION_SUMMARY.md- Implementation overview- Component JSDoc comments - In-code documentation