From 3d3074077ddfa0da5b64f265bb12ff00aa834378 Mon Sep 17 00:00:00 2001 From: Amanda Bullington Date: Wed, 29 Nov 2023 15:45:32 -0800 Subject: [PATCH] Restyle unknown text; closes #881 --- src/components/ObsDetails/Header.js | 9 +++- .../unit/components/ObsDetails/Header.test.js | 46 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/unit/components/ObsDetails/Header.test.js diff --git a/src/components/ObsDetails/Header.js b/src/components/ObsDetails/Header.js index 463825097..ab46220a6 100644 --- a/src/components/ObsDetails/Header.js +++ b/src/components/ObsDetails/Header.js @@ -1,10 +1,11 @@ // @flow import { useNavigation } from "@react-navigation/native"; import { + Body1, DateDisplay, DisplayTaxon, InlineUser, ObservationLocation } from "components/SharedComponents"; import ObsStatus from "components/SharedComponents/ObservationsFlashList/ObsStatus"; -import { Text, View } from "components/styledComponents"; +import { View } from "components/styledComponents"; import type { Node } from "react"; import React from "react"; import { @@ -33,7 +34,11 @@ const Header = ( { const showTaxon = () => { if ( !taxon ) { - return {t( "Unknown-organism" )}; + return ( + + {t( "Unknown" )} + + ); } return ( { + beforeAll( async ( ) => { + await initI18next( ); + } ); + + it( "displays unknown text if no taxon", async ( ) => { + renderComponent( +
+ ); + + const unknownText = screen.getByText( /Unknown/ ); + expect( unknownText ).toBeVisible( ); + } ); + + it( "displays taxon", async ( ) => { + renderComponent( +
+ ); + + const taxonName = screen.getByText( mockTaxon.name ); + expect( taxonName ).toBeVisible( ); + } ); +} );