Files
iNaturalistReactNative/tests/unit/components/Match/EmptyMapSection.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

46 lines
1.4 KiB
JavaScript

import { fireEvent, screen } from "@testing-library/react-native";
import EmptyMapSection from "components/Match/EmptyMapSection";
import React from "react";
import { renderComponent } from "tests/helpers/render";
describe( "EmptyMapSection", () => {
const mockHandleAddLocationPressed = jest.fn();
it( "displays the location indicator icon", () => {
renderComponent(
<EmptyMapSection
isFetchingLocation={false}
handleAddLocationPressed={mockHandleAddLocationPressed}
/>,
);
const locationIndicator = screen.getByTestId( "Map.LocationIndicator" );
expect( locationIndicator ).toBeVisible();
} );
it( "calls handleAddLocationPressed when button is pressed", () => {
renderComponent(
<EmptyMapSection
isFetchingLocation={false}
handleAddLocationPressed={mockHandleAddLocationPressed}
/>,
);
const button = screen.getByText( "ADD LOCATION FOR BETTER IDS" );
fireEvent.press( button );
expect( mockHandleAddLocationPressed ).toHaveBeenCalled();
} );
it( "shows loading state when isFetchingLocation is true", () => {
renderComponent(
<EmptyMapSection
isFetchingLocation
handleAddLocationPressed={mockHandleAddLocationPressed}
/>,
);
const button = screen.getByLabelText( "Edit location" );
expect( button.props.accessibilityState.disabled ).toBe( true );
} );
} );