mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
e206970c8c647ae1f0eb2b3def7c4947bf84a3b9
* Move realm object creation functions into realm classes * Make all fields except for uuids optional in realm & update schemaVersion * Add pre-commit hooks for linting * Add eslint automatic fix line * Testing pre-commit hook * Still testing * Tweak husky settings and remove lint-staged * Add a Taxon realm shared by Observation and Identification; add listener for obs list changes * Create new User realm model for Comments/Identifications * Remove code comments from models * Add loading wheel while ObsList is fetching initial data * Move observations into stack within drawer navigator * Remove unneeded code * Look up existing obs using .objectForPrimaryKey method * More code cleanup (naming, adding primary keys, etc.) * Merge testing code from main; remove unused imports * Add more factories and fix ObsCard tests * Update tests to match updated realm models * Move ObservationProvider to wrap MyObservationsStackNavigator instead of all navigation * Remove code comments * Add primary keys to User and Taxon schemas * Update realm models to include ObservationPhotos * Get integration test to pass with new realm schemas
iNaturalistReactNative
Install packages and pods
- Run
npm install - Run
npx pod-install iosorcd ios && pod installfrom the root directory
Set up pre-commit hooks
- We're using Husky to automatically run
eslintbefore each commit. Runnpm run prepareto install Husky locally.
Run build
- Run
npm start -- --reset-cache(npm startworks too, but resetting the cache each time makes for a lot less build issues) - Run
npm run iosornpm run android
Tests
# Run all tests
npm test
# Run test paths matching a pattern
./node_modules/.bin/jest MyObs
# Run individual tests matching a pattern
./node_modules/.bin/jest -t accessibility
We currently have two kinds of tests
tests/integration: Tests the test the integration of multiple modules, e.g. a list of observation that makes requests to a mocked API, persists the response data in local storage, retrieves the data from local storage and renders components.tests/unit: Tests that only test specific modules, like a single component, or a hook.
We're using Jest and React Native Testing Library for most of our tests, factoria and faker.js to generate test data for use with mocks. Local* model factories represent locally persisted data, while Remote* factories represent that kinds of records we get from an API or external package.
Troubleshooting
- Run
react-native clean-project. This will give you options to clean caches, clean builds, reinstall pods, and reinstall node_modules. Using this eliminates a lot of hard-to-diagnose build issues.
Description
Languages
Fluent
63.1%
JavaScript
19.6%
TypeScript
16.8%
Ruby
0.4%