Commit Graph

18 Commits

Author SHA1 Message Date
Ken-ichi Ueda
096af978f0 Test fixes
* updated snapshots
* move timezone setup to globalSetup
* renamed old global setup file to reflect what it actually does, which is
  setup i18next
2024-02-21 10:47:31 -08:00
Amanda Bullington
045ce6f789 Improve Jest performance (#1160)
* Use faker import with specific locale

* Add global beforeAll to initiate i18next
2024-02-16 16:17:00 -08:00
Ken-ichi Ueda
54f3f9eb47 Extracted unique Realm test setup code into a helper
There's still some required copy-pasting because jest is weird, but at least
there's less of it.
2024-02-14 15:40:35 -08:00
Amanda Bullington
8e6269c8d0 Wrap realm.write in safeRealmWrite transaction (#1123)
* Add a safeRealmWrite transaction for better logging around writes; code cleanup and realm update

* Add safeRealmWrite to tests and make sure action is called synchronously

* Fix final test

* Only write to realm when useObservationsUpdates data changes; code cleanup

* Code cleanup
2024-02-09 16:16:32 -08:00
Amanda Bullington
3a485f4d4b Load ObsDetails skeleton before observation data is ready (#1116)
* Load ObsDetail screen skeleton and loading wheels before observation is fetched; closes #1091

* Fix e2e test: make sure ActivityIndicator doesn't stay rendered
2024-02-06 17:09:51 -08:00
Ken-ichi
4e42ebc262 Community taxon opt out notice (#1060)
* Shows notice when user or obs is opted out of Community Taxon on ObsDetails
  (closes #882)
* Unifies mapApiToRealm methods around a single interface
* Ensure that the remote obs used on ObsDetail is normalized to look like a
  local obs
* Ensure some tests that use signIn() have isolated Realm instances
* Update current user's obs from ObsDetails (closes #1045) 
* Fixed CC0 license display on ObsDetails (was not actually related to
  updating the local copy of the obs
2024-01-18 20:16:30 -08:00
Ken-ichi
799e0f4c4f Restore tests removed in recent suggeston fixes (#1001)
* Restored Suggestions navigation tests
* Restored SuggestionsWithSyncedObs.test.js tests
* Mocked vision-camera-plugin-inatvision instead of useOfflineSuggestions
* Removed unnecessarily complex object from navigation params

There were a lot of issues here, but the main ones (I think) were related to
rendering all the navigators and waiting for asynchronous stuff to happen
before proceeding with the test.
2024-01-05 19:48:46 -08:00
Ken-ichi
f7dc08a704 Suggestions fixes (#972)
* Bugfix: TaxonDetails was crashing if it received a null taxon
* Send lat and lng instead of latitude and longitude to the score_image
  endpoint
* Show offline suggestions when you are offline
* Show notice when viewing offline suggestions
* Moved code unique to useOnlineSuggestions into that file
* Ensure we use a medium size image to get suggestions when dealing with
  remote URLs
* More logging around React Query retries
* Use default retry logic for useAuthenticatedQuery
* Made a module-resolver shortcut for tests
* Move offline notice above top suggestion; hide when offlines exist but onlines do too
2023-12-15 19:58:12 -08:00
Ken-ichi
d3f1f8ed6e View photos in MediaViewer from ObsDetail (#962)
* Unit tests for MediaViewer
* Added editable prop to MediaViewer
* MediaViewer navigation test
* Made MediaViewer a modal
2023-12-13 09:33:06 -08:00
Amanda Bullington
808cbee452 Replace ObsEditProvider with zustand for global state management (#948)
* Add zustand to app

* Begin replacing ObsEditProvider with zustand for global state

* Use store and add tests

* Fix bugs

* Add test to check for deleted photos in StandardCamera

* Make sure evidence is only added to current observation; submit comment with ID on ObsDetail

* Fix ObsEditWithoutProvider tests

* Move store to where it's needed

* Fix tests

* Await evidence being added to obsPhotos from camera

* Add a note about slices to useStore
2023-12-05 14:10:00 -08:00
budowski
58de692298 364 sharing photos to inat (#568)
Allows user to share photos from gallery apps to our app as new observations via react-native-share-menu. Also added patch-package and patched react-native-share-menu for Android prod builds. Patch addresses https://github.com/meedan/react-native-share-menu/issues/216

Closes #364

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-05-17 13:24:38 -07:00
Chris
98a6663fe1 561 fix hidden bottom sheet (#563)
* Show bottom sheet over tab bar

* use present method

* Ensure bottom sheet works elsewhere

* Ensure bottom sheet works elsewhere

* Add provider to test

* lint

* Fix tests

* Merge fixes

---------

Co-authored-by: Amanda Bullington <35536439+albullington@users.noreply.github.com>
Co-authored-by: Amanda Bullington <albullington@gmail.com>
2023-04-04 12:30:07 -07:00
Amanda Bullington
ba181e75fd Remove warnings about custom icons / Material icons in jest (#429)
* Mock INatPaperProvider to remove warnings about wrong icon names in jest; closes #421

* Remove unnecessary paper provider mock

* Add mocked views back to tests
2023-02-03 08:38:51 -08:00
Johannes Klein
f8c403b9b1 353 retry with jwt (#382)
* Rename some functions and variables

* Rename function

* Revert to original timeout for tokens

* Get JWT for a 401 or 403 http errors in the react-query QueryClient retry handler

* Log API error to new logger

* Fetch token on every render in useApiToken hook

* Remove commented code

* Add comment

* Remove useEffect from useApiToken

* Revert "Remove useEffect from useApiToken"

This reverts commit 9cf1e0c0bc.
2023-01-29 10:09:50 +01:00
Amanda Bullington
28099b5922 Add test for checking locale changes from remote (#294)
Add test for checking locale changes from remote; closes #287

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-01-09 09:30:07 -08:00
Ken-ichi Ueda
f442603e7a Disable unnecessary API requests on My Obs when signed out
Also added a signOut test helper... and maybe have introduced some problems
with parallel test execution as a result, as parallel jest runs don't seem to
totally separate with regards to the in-memory realm db. Something to think
about.
2022-12-09 19:39:13 -08:00
Amanda Bullington
8d738d9d8c Delete observations from ObsEdit (#277)
* Remove delete option for observations not in realm
* Add mutation for delete observation
* Hide delete option for observations not persisted to realm
* Close kebab menu when item pressed; this allows dialog to respond to first user
   press

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-12-09 17:36:47 -08:00
Amanda Bullington
0d69fe1568 Fetch user locale from server and change language (#255)
* Fetch user from server, set locale in realm and change language with i18next
* Added some Spanish translations so I can see localization working
* config QueryClient with `cacheTime: Infinity` to deal with "Jest did not
  exit" errors

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-12-09 15:51:17 -08:00