Add a unit test for when taxon is undefined

This commit is contained in:
Johannes Klein
2025-12-07 21:39:00 +01:00
parent f1eba8d7c8
commit 2a51f5ad9c

View File

@@ -275,6 +275,14 @@ describe( "DisplayTaxonName", ( ) => {
} );
} );
describe( "when taxon is undefined", ( ) => {
it( "it displays fallback text", ( ) => {
let taxon;
render( <DisplayTaxonName taxon={taxon} /> );
expect( screen.getByText( /Unknown/ ) ).toBeTruthy( );
} );
} );
describe( "when displayed as plain text within a Trans component", ( ) => {
it( "it displays common name followed by scientific name", async ( ) => {
render( <DisplayTaxonName taxon={subspeciesTaxon} removeStyling layout="horizontal" /> );