Files
iNaturalistReactNative/tests/unit/components/SharedComponents/OfflineNotice.test.js
Ken-ichi 0b2c8315a0 OfflineNotice (#1388)
* Added clean script; fixed UI Library
* OfflineNotice component; added to Notifications
* OfflineNotice on ObsDetails media
* OfflineNotice for DQA
2024-04-11 17:25:55 -07:00

19 lines
661 B
JavaScript

import { fireEvent, render, screen } from "@testing-library/react-native";
import OfflineNotice from "components/SharedComponents/OfflineNotice";
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( );
} );
} );