mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-05 14:15:27 -04:00
The problem has something to do with the unicode capitalization code that got ported from the web. It seems like the JS engine in Android has a problem with calling toUpperCase() on some unicode characters, and this gets around that particular bug, plus one problem with a null check on a Realm collection.
46 lines
1.2 KiB
JavaScript
46 lines
1.2 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", {
|
|
taxon: { preferred_common_name: "Foo", name: "bar" }
|
|
} );
|
|
|
|
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
|
|
} (${
|
|
mockObservation.taxon.rank
|
|
} ${
|
|
mockObservation.taxon.name
|
|
})`
|
|
) ).toBeTruthy( );
|
|
expect( getByTestId( "ObsList.photo" ).props.source )
|
|
.toStrictEqual( { uri: mockObservation.observation_photos[0].photo.url } );
|
|
} );
|