mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-09-21 02:42:03 -04:00
37 lines
815 B
JavaScript
37 lines
815 B
JavaScript
import { render, screen } from "@testing-library/react-native";
|
|
import { TaxonResult } from "components/SharedComponents";
|
|
import React from "react";
|
|
|
|
const mockTaxon = {
|
|
id: 1,
|
|
name: "Aves",
|
|
preferred_common_name: "Birds",
|
|
rank: "family",
|
|
rank_level: 60,
|
|
};
|
|
|
|
jest.mock( "sharedHooks/useCurrentUser", ( ) => ( {
|
|
__esModule: true,
|
|
default: () => undefined,
|
|
} ) );
|
|
|
|
jest.mock( "sharedHooks/useTaxon", () => ( {
|
|
__esModule: true,
|
|
default: () => ( { taxon: mockTaxon } ),
|
|
} ) );
|
|
|
|
describe( "TaxonResult", () => {
|
|
it( "should render correctly", () => {
|
|
render(
|
|
<TaxonResult
|
|
accessibilityHint="Chooses taxon"
|
|
handleTaxonOrEditPress={jest.fn( )}
|
|
taxon={mockTaxon}
|
|
testID="TaxonResult.test"
|
|
/>,
|
|
);
|
|
|
|
expect( screen ).toMatchSnapshot();
|
|
} );
|
|
} );
|