mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-06-21 22:18:32 -04:00
* 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
29 lines
584 B
JavaScript
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();
|
|
} );
|
|
} );
|