Files
iNaturalistReactNative/tests/unit/components/SharedComponents/TaxonResult.test.js
Ken-ichi 6fdf3d2faf Taxon result updates (#1254)
* Only requests remote taxon if local is missing or hasn't been synced in a
  week
* Returns a localized version of the remote taxon immediately without waiting
  to get a newly-created record from realm
* Expands tests to use a unique realm, integrate more of our code, and check
  to ensure the API gets called
* Show indicator while loading taxon on ARCamera
* Show iconic taxon found in model results if we can't load a remote taxon
* Show iconic taxon as backdrop for ObsImage whenever possible
2024-03-05 16:54:42 -08:00

29 lines
584 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/useTaxon", () => ( {
__esModule: true,
default: () => ( { taxon: mockTaxon } )
} ) );
describe( "TaxonResult", () => {
it( "should render correctly", () => {
render(
<TaxonResult
taxon={mockTaxon}
/>
);
expect( screen ).toMatchSnapshot();
} );
} );