Documentation Index
Fetch the complete documentation index at: https://mintlify.com/satsigner/satsigner/llms.txt
Use this file to discover all available pages before exploring further.
Overview
SatSigner uses Jest as its testing framework, with separate test suites for unit and integration testing. Tests are located inapps/mobile/tests/ and follow best practices for React Native and TypeScript projects.
Test Structure
Jest Configuration
jest.config.js
Running Tests
package.json
Unit Testing
Testing Zustand Stores
Store tests verify state management logic:tests/unit/store/nostr.test.ts
Testing Utilities
Unit tests for utility functions:tests/unit/utils/bitcoin.test.ts
Integration Testing
Testing API Clients
Integration tests verify API client functionality against real endpoints:tests/int/api/esplora.test.ts
Mocking Dependencies
Mock MMKV Storage
__mocks__/mmkv.ts
Mock API Responses
Mock BDK Wallet
Test Data Fixtures
Create reusable test fixtures:tests/fixtures/accounts.ts
Testing Best Practices
- Isolate Tests - Each test should be independent and not rely on others
- Mock External Dependencies - Mock API calls, storage, and third-party libraries
- Use Descriptive Names - Test names should clearly describe what they test
- Test Edge Cases - Include tests for error conditions and edge cases
- Keep Tests Fast - Unit tests should run quickly; save slow tests for integration
- Coverage Goals - Aim for high coverage but focus on critical paths
- Test Behavior, Not Implementation - Test what the code does, not how it does it
- Use Fixtures - Create reusable test data to keep tests DRY
- Clean Up - Reset state in
beforeEachorafterEachhooks - Integration Tests Separately - Keep integration tests in separate directory
Coverage Reports
Generate coverage reports:- Terminal output
coverage/lcov-report/index.htmlfor HTML report
- Stores: >80% coverage
- Utilities: >90% coverage
- API Clients: >70% coverage (integration tests)
- Components: >60% coverage (with Storybook)
Continuous Integration
Run tests in CI/CD pipeline:.github/workflows/test.yml
Debugging Tests
Debug failing tests:Resources
- Component Development - Component testing with Storybook
- State Management - Store patterns to test
- API Integration - API clients to test
- Jest Documentation
- React Native Testing Library
- Testing Best Practices