mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-04-19 06:23:12 -04:00
* (lint) MOB-1063 enforce trailing commas * autofix trailing commas * manually fix newly introduced maxlen violations * add trailing comma convention to i18n build
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
import { screen } from "@testing-library/react-native";
|
|
import AdditionalSuggestionsScroll
|
|
from "components/Match/AdditionalSuggestions/AdditionalSuggestionsScroll";
|
|
import React from "react";
|
|
import factory from "tests/factory";
|
|
import { renderComponent } from "tests/helpers/render";
|
|
|
|
describe( "AdditionalSuggestionsScroll", () => {
|
|
it( "returns null when not loading and otherSuggestions is empty", () => {
|
|
renderComponent(
|
|
<AdditionalSuggestionsScroll
|
|
otherSuggestions={[]}
|
|
suggestionsLoading={false}
|
|
onSuggestionChosen={jest.fn()}
|
|
/>,
|
|
);
|
|
|
|
expect( screen.queryByText( "It might also be" ) ).toBeFalsy();
|
|
expect( screen.queryByText( "It might be one of these" ) ).toBeFalsy();
|
|
} );
|
|
|
|
it( "shows ActivityIndicator when suggestionsLoading is true", () => {
|
|
renderComponent(
|
|
<AdditionalSuggestionsScroll
|
|
otherSuggestions={[]}
|
|
suggestionsLoading
|
|
onSuggestionChosen={jest.fn()}
|
|
/>,
|
|
);
|
|
expect( screen.getByRole( "progressbar" ) ).toBeVisible();
|
|
} );
|
|
|
|
it( "renders heading when noTopSuggestion is true", () => {
|
|
const suggestions = [
|
|
{
|
|
taxon: factory( "RemoteTaxon" ),
|
|
combined_score: 85,
|
|
},
|
|
];
|
|
|
|
renderComponent(
|
|
<AdditionalSuggestionsScroll
|
|
noTopSuggestion
|
|
otherSuggestions={suggestions}
|
|
suggestionsLoading={false}
|
|
onSuggestionChosen={jest.fn()}
|
|
/>,
|
|
);
|
|
|
|
expect( screen.getByText( "It might be one of these" ) ).toBeVisible();
|
|
} );
|
|
} );
|