UNPKG

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

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

59 lines (49 loc) 1.43 kB
import React from "react"; import { shallow } from "enzyme"; import { shallowToJson } from "enzyme-to-json"; 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(), }) ); const { Scene } = require("../Scene"); const wrapper = shallow( <Scene style={style} overlayStyle={overlayStyle} contentStyle={contentStyle} /> ); describe("<Scene />", () => { it("renders correctly", () => { expect(shallowToJson(wrapper)).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(shallowToJson(wrapper).type).toEqual("AnimatedComponent"); }); it("renders the overlay while animating", () => { const wrapperWithOverlay = shallow( <Scene style={style} overlayStyle={overlayStyle} contentStyle={contentStyle} animating /> ); expect(shallowToJson(wrapperWithOverlay)).toMatchSnapshot(); }); });