UNPKG

@applicaster/zapp-react-native-ui-components

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

70 lines (57 loc) 1.78 kB
import React from "react"; import { render } from "@testing-library/react-native"; import { Scene } from "../Scene"; const overlayStyle = { opacity: 1 }; const contentStyle = { paddingBottom: 49 }; const style = { flex: 1 }; jest.mock("react-native-safe-area-context", () => ({ useSafeAreaFrame: jest.fn(() => ({ fontScale: 2, height: 1334, scale: 2, statusBarHeight: null, width: 750, })), })); jest.mock( "@applicaster/zapp-react-native-ui-components/Components/Screen/orientationHandler", () => ({ useScreenOrientationHandler: jest.fn(), }) ); jest.mock("../../../Contexts/PathnameContext", () => ({ PathnameContext: jest.requireActual("react").createContext({ pathname: "" }), })); jest.mock("../../../Contexts/ScreenDataContext", () => ({ ScreenDataContext: jest.requireActual("react").createContext({}), })); jest.mock("../../../Contexts/ScreenContext", () => ({ ScreenContextProvider: jest.requireActual("react-native").View, })); describe("<Scene />", () => { const wrapper = render( <Scene style={style} overlayStyle={overlayStyle} contentStyle={contentStyle} /> ); it("renders correctly", () => { expect(wrapper.toJSON()).toMatchSnapshot(); }); // skipped - this isn't a very useful test, and it doesn't work as it used to on the new version of RN it.skip("renders children surrounded by AnimatedComponent", () => { expect(wrapper.toJSON()).toEqual("AnimatedComponent"); }); it("renders the overlay while animating", () => { const wrapperWithOverlay = render( <Scene style={style} overlayStyle={overlayStyle} contentStyle={contentStyle} animating /> ); expect(wrapperWithOverlay.toJSON).toMatchSnapshot(); }); });