test: add Jest config, unit tests, and CI workflow#473
Merged
Conversation
mCodex
commented
Oct 27, 2025
Owner
- Add jest.config.js and tsconfig.test.json for test environment
- Add comprehensive unit tests and mocks under src/tests
- Add GitHub Actions workflow .github/workflows/test.yml to run tests
- Add test scripts and devDependencies (jest, ts-jest, jest-environment-jsdom, @testing-library, ts-node, react-dom) and update yarn.lock
- Move coverage badge & add React Native minimum to README; minor .gitignore newline fix
- Add jest.config.js and tsconfig.test.json for test environment - Add comprehensive unit tests and mocks under src/__tests__ - Add GitHub Actions workflow .github/workflows/test.yml to run tests - Add test scripts and devDependencies (jest, ts-jest, jest-environment-jsdom, @testing-library, ts-node, react-dom) and update yarn.lock - Move coverage badge & add React Native minimum to README; minor .gitignore newline fix
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive testing infrastructure for the react-native-sensitive-info library, including Jest configuration, unit tests for core functionality and React hooks, mocking utilities, and a GitHub Actions CI workflow to run tests automatically.
Key Changes
- Added Jest testing infrastructure with TypeScript support (jest.config.js, tsconfig.test.json)
- Created comprehensive unit tests covering storage operations, hooks, internal utilities, and error handling
- Implemented GitHub Actions workflow to run tests on push/PR with coverage reporting
Reviewed Changes
Copilot reviewed 22 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.test.json | TypeScript configuration for test environment with CommonJS module support |
| src/tests/storage.test.ts | Unit tests for core storage API functions with mocked native layer |
| src/tests/internal.options.test.ts | Tests for options normalization and default value handling |
| src/tests/internal.native.test.ts | Tests verifying native instance memoization behavior |
| src/tests/internal.errors.test.ts | Tests for error detection and message extraction utilities |
| src/tests/index.test.ts | Tests ensuring package entrypoint exports are correct |
| src/tests/hooks.useStableOptions.test.tsx | Tests for options memoization hook behavior |
| src/tests/hooks.useSecurityAvailability.test.tsx | Tests for security capabilities detection hook |
| src/tests/hooks.useSecureStorage.test.tsx | Comprehensive tests for secure storage hook operations |
| src/tests/hooks.useSecureOperation.test.tsx | Tests for async operation wrapper hook |
| src/tests/hooks.useSecretItem.test.tsx | Tests for individual secret item management hook |
| src/tests/hooks.useSecret.test.tsx | Tests for secret CRUD operations hook |
| src/tests/hooks.useHasSecret.test.tsx | Tests for secret existence checking hook |
| src/tests/hooks.useAsyncLifecycle.test.tsx | Tests for async lifecycle management utilities |
| src/tests/hooks.types.test.ts | Tests for hook error types and state initializers |
| src/tests/hooks.error-utils.test.ts | Tests for hook error creation utility |
| src/tests/core.storage.test.ts | Detailed tests for storage layer with native delegation |
| src/tests/mocks/react-native.ts | Mock implementation of React Native core modules |
| src/tests/mocks/react-native-nitro-modules.ts | Mock implementation of Nitro Modules hybrid objects |
| package.json | Added test scripts and testing dependencies (Jest, Testing Library, ts-jest) |
| README.md | Added coverage badge and React Native minimum version requirement |
| .github/workflows/test.yml | CI workflow configuration for running tests on push/PR |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.