Files
iNaturalistReactNative/tests/unit/components/About.test.js
Johannes Klein 1b4039eb36 417 eslint testing (#419)
* Add eslint-plugin-testing-library dependency

* Enable plugin inside tests folder

* Fix errors given by eslint-plugin
2023-02-01 12:50:59 +01:00

19 lines
590 B
JavaScript

import { fireEvent, screen } from "@testing-library/react-native";
import About from "components/About";
import React from "react";
import Mailer from "react-native-mail";
import { renderComponent } from "../../helpers/render";
jest.mock( "react-native-mail", ( ) => ( {
mail: jest.fn( )
} ) );
test( "native email client is opened on button press", ( ) => {
renderComponent( <About /> );
const debugLogButton = screen.getByText( /EMAIL-DEBUG-LOGS/ );
expect( debugLogButton ).toBeTruthy( );
fireEvent.press( debugLogButton );
expect( Mailer.mail ).toHaveBeenCalled( );
} );