Files
iNaturalistReactNative/tests/unit/components/Projects/ProjectObservations.test.js
Amanda Bullington c740a06224 Start using Tailwind CSS (#185)
Starts changing styles over to tailwind via nativewind.

* Update node to 16.17.0
* Use styled() to ignore flow errors about className or tw props when styling components with nativewind
* Upgrade realm to make test suite run; set failing test in Explore as todo
* Add workaround for getting pods to run with XCode 14
* Fix for loading remote obs with infinite scroll
* Add styling section to README
* Use IconButton from rn-paper to make buttons more responsive to press
* Add caret next to camera roll album picker
* Fixed broken addition of gallery photos to existing observation
* Removed flatlist from scrollview on ProjectDetails (apparently not allowed?)
* Moved border style from Image to container in PhotoCarousel (border color
  not allowed for images?)

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-10-19 17:15:55 -07:00

53 lines
1.5 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", ( ) => {
renderProjectDetails( );
// TODO restore these when we figure out why a FlatList can be inside a scrollview
// 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 } );
} );