mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-01-02 10:58:12 -05:00
19 lines
665 B
JavaScript
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( );
|
|
} );
|
|
} );
|