mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-19 05:47:33 -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>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 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" );
|
|
|
|
jest.mock( "sharedHooks/useAuthenticatedQuery", ( ) => ( {
|
|
__esModule: true,
|
|
default: ( ) => ( {
|
|
data: mockProject
|
|
} )
|
|
} ) );
|
|
|
|
jest.mock( "@react-navigation/native", ( ) => {
|
|
const actualNav = jest.requireActual( "@react-navigation/native" );
|
|
return {
|
|
...actualNav,
|
|
useRoute: ( ) => ( {
|
|
params: {
|
|
id: mockProject.id
|
|
}
|
|
} )
|
|
};
|
|
} );
|
|
|
|
test( "displays project details", ( ) => {
|
|
const { getByTestId, getByText } = renderComponent( <ProjectDetails /> );
|
|
|
|
expect( getByText( mockProject.title ) ).toBeTruthy( );
|
|
expect( getByText( mockProject.description ) ).toBeTruthy( );
|
|
expect(
|
|
getByTestId( "ProjectDetails.headerImage" ).props.source
|
|
).toStrictEqual( { uri: mockProject.header_image_url } );
|
|
expect(
|
|
getByTestId( "ProjectDetails.projectIcon" ).props.source
|
|
).toStrictEqual( { uri: mockProject.icon } );
|
|
} );
|