mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-04-20 23:10:53 -04:00
* 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>
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
import ProjectDetails from "components/Projects/ProjectDetails";
|
|
import React from "react";
|
|
|
|
import factory from "../../../factory";
|
|
import { renderComponent } from "../../../helpers/render";
|
|
|
|
const mockProject = factory( "RemoteProject" );
|
|
const mockObservation = factory( "RemoteObservation" );
|
|
|
|
jest.mock( "@react-navigation/native", ( ) => {
|
|
const actualNav = jest.requireActual( "@react-navigation/native" );
|
|
return {
|
|
...actualNav,
|
|
useRoute: ( ) => ( {
|
|
params: {
|
|
id: mockProject.id
|
|
}
|
|
} )
|
|
};
|
|
} );
|
|
|
|
jest.mock( "sharedHooks/useAuthenticatedQuery", ( ) => ( {
|
|
__esModule: true,
|
|
default: ( ) => ( {
|
|
data: [mockObservation]
|
|
} )
|
|
} ) );
|
|
|
|
test( "displays project observations", ( ) => {
|
|
const { getByTestId, getByText } = renderComponent( <ProjectDetails /> );
|
|
|
|
expect( getByText( mockObservation.taxon.preferred_common_name ) ).toBeTruthy( );
|
|
expect( getByTestId( "ObsList.photo" ).props.source )
|
|
.toStrictEqual( { uri: mockObservation.observation_photos[0].photo.url } );
|
|
} );
|