Files
iNaturalistReactNative/tests/unit/components/SharedComponents/OfflineNotice.test.js
Johannes Klein 4793b716ff 1520 explore offline notice (#1697)
* OfflineNotice TS

* Show OfflineNotice on Explore
2024-06-20 16:06:48 +02:00

19 lines
665 B
JavaScript

import { fireEvent, render, screen } from "@testing-library/react-native";
import OfflineNotice from "components/SharedComponents/OfflineNotice.tsx";
import i18next from "i18next";
import React from "react";
describe( "OfflineNotice", ( ) => {
it( "should throw without an onPress prop", ( ) => {
expect( ( ) => render( <OfflineNotice /> ) ).toThrow( );
} );
it( "should be pressable", ( ) => {
const onPress = jest.fn( );
render( <OfflineNotice onPress={onPress} /> );
const notice = screen.getByLabelText( i18next.t( "Internet-Connection-Required" ) );
fireEvent.press( notice );
expect( onPress ).toHaveBeenCalled( );
} );
} );