mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-06 14:46:20 -04:00
* Use authenticated query for search results * Use search API for fetching places from Settings * Use authenticated query for authorized applications * Use authenticated query to fetch user.me * Move fetch/search api calls into react query format, out of hooks * Update with react query instead of hooks * Fetch list of blocked and muted users with authenticated query * Added Podfile postinstall block to get app running in a Simulator * Use auth query in identify * Upgrade @realm/react library to 0.4.0; fixes initialization error on android due to importing realm * Use authquery for explore provider * Use mutations for blocking/muting users, invalidating queries, and refetching settings data * Add react mutation to create/update/delete api calls * Use mutation for creating identification on identity/obs detail screens * Use mutations to update and delete relationships * Use mutation to revoke authorized apps * Use mutation for updating user settings * Fix ids on activity tab; fix safe area view; fix mark viewed * Limit fields for remote observation api call Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
import { NavigationContainer } from "@react-navigation/native";
|
|
import {
|
|
QueryClient,
|
|
QueryClientProvider
|
|
} from "@tanstack/react-query";
|
|
import { render } from "@testing-library/react-native";
|
|
import ProjectDetails from "components/Projects/ProjectDetails";
|
|
import React from "react";
|
|
|
|
import factory from "../../../factory";
|
|
|
|
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
|
|
}
|
|
} )
|
|
};
|
|
} );
|
|
|
|
const queryClient = new QueryClient( );
|
|
|
|
const renderProjectDetails = ( ) => render(
|
|
<QueryClientProvider client={queryClient}>
|
|
<NavigationContainer>
|
|
<ProjectDetails />
|
|
</NavigationContainer>
|
|
</QueryClientProvider>
|
|
);
|
|
|
|
jest.mock( "sharedHooks/useAuthenticatedQuery", ( ) => ( {
|
|
__esModule: true,
|
|
default: ( ) => ( {
|
|
data: [mockObservation]
|
|
} )
|
|
} ) );
|
|
|
|
test( "displays project observations", ( ) => {
|
|
const { getByTestId, getByText } = renderProjectDetails( );
|
|
|
|
expect( getByText( mockObservation.taxon.preferred_common_name ) ).toBeTruthy( );
|
|
expect( getByTestId( "ObsList.photo" ).props.source )
|
|
.toStrictEqual( { uri: mockObservation.observation_photos[0].photo.url } );
|
|
} );
|