mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-06-19 21:18:35 -04:00
* 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
24 lines
696 B
JavaScript
24 lines
696 B
JavaScript
import { renderHook } from "@testing-library/react-native";
|
|
import { useCurrentUser } from "sharedHooks";
|
|
import factory from "tests/factory";
|
|
|
|
const mockUser = factory( "LocalUser", {
|
|
login: "fake_login",
|
|
signedIn: true
|
|
} );
|
|
|
|
describe( "useCurrentUser", () => {
|
|
beforeEach( async ( ) => {
|
|
// Write mock observations to realm
|
|
await global.realm.write( () => {
|
|
global.realm.create( "User", mockUser );
|
|
} );
|
|
} );
|
|
|
|
it( "should return current user", () => {
|
|
const { result } = renderHook( () => useCurrentUser() );
|
|
const user = global.realm.objects( "User" ).filtered( "signedIn == true" )[0];
|
|
expect( user.login ).toEqual( result.current.login );
|
|
} );
|
|
} );
|