Files
iNaturalistReactNative/tests/unit/components/AddObsModal/AddObsModal.test.js
Johannes Klein 9c90c2e45f Update react-native to 0.79 (#3051)
* Upgrade helper: package.json

* Upgrade helper: gems

* Upgrade helper: Android

* Update AppDelegate

* Fix error in compiling

* Update package-lock.json

* Update Podfile.lock

* Update package-lock.json

* Update Podfile.lock

* Remove no longer needed mock

* Comment out entire test and not only the expect call

* Most other unit tests use this render helper function that

wraps the component in the entire app.

* Mock react-native exports as esModule

* Update .flowconfig

* Update Gemfile

* Revert "Comment out entire test and not only the expect call"

This reverts commit 8785f81529.
2025-10-01 22:44:14 -05:00

25 lines
692 B
JavaScript

import { render, screen } from "@testing-library/react-native";
import AddObsModal from "components/AddObsModal/AddObsModal";
import i18next from "i18next";
import React from "react";
// Make sure the mock is using a recent-ish version
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
__esModule: true,
default: {
OS: "ios",
select: jest.fn( ),
Version: 11
}
} ) );
describe( "AddObsModal", ( ) => {
it( "shows the AI camera button", async ( ) => {
render( <AddObsModal closeModal={jest.fn( )} /> );
const aiCameraButton = screen.getByLabelText(
i18next.t( "AI-Camera" )
);
expect( aiCameraButton ).toBeOnTheScreen();
} );
} );