Files
iNaturalistReactNative/tests/unit/components/ObsDetails/ObsDetailsOverview.test.js
Ryan Stelly b78be9243d lint rule & autofix for "trailing comma" (#3299)
* (lint) MOB-1063 enforce trailing commas

* autofix trailing commas

* manually fix newly introduced maxlen violations

* add trailing comma convention to i18n build
2025-12-22 20:17:13 -06:00

41 lines
1.0 KiB
JavaScript

import { screen } from "@testing-library/react-native";
import ObsDetailsOverview from "components/ObsDetails/ObsDetailsOverview";
import React from "react";
import factory from "tests/factory";
import faker from "tests/helpers/faker";
import { renderComponent } from "tests/helpers/render";
const mockTaxon = factory( "RemoteTaxon", {
name: faker.person.firstName( ),
rank: "genus",
preferred_common_name: faker.person.fullName( ),
} );
describe( "ObsDetailsOverview", () => {
it( "displays unknown text if no taxon", async ( ) => {
renderComponent(
<ObsDetailsOverview
observation={{
taxon: null,
}}
/>,
);
const unknownText = screen.getByText( /Unknown/ );
expect( unknownText ).toBeVisible( );
} );
it( "displays taxon", async ( ) => {
renderComponent(
<ObsDetailsOverview
observation={{
taxon: mockTaxon,
}}
/>,
);
const taxonName = screen.getByText( mockTaxon.name );
expect( taxonName ).toBeVisible( );
} );
} );