import React from "react"; import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils"; const props = { entry: { id: "test" }, style: { height: 800, width: 300, }, containerStyle: {}, configuration: { tablet_landscape_sidebar_width: "35%", tablet_landscape_player_container_background_color: "red", }, playerContent: jest.fn(() => <>), }; const mockUseIsDeviceTablet = jest.fn(); jest.mock("react-native"); jest.mock("react-native-gesture-handler"); jest.mock("../PlayerDetails", () => { const View = jest.requireActual("react-native").View; return { PlayerDetails: View }; }); jest.mock( "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext", () => ({ useScreenContext: jest.fn().mockReturnValue({ screen: {}, entry: {} }), }) ); jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({ useIsTablet: mockUseIsDeviceTablet, })); jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({ ...jest.requireActual("@applicaster/zapp-react-native-utils/theme"), useTheme: jest.fn(() => ({})), })); jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({ isTV: jest.fn(() => false), isAndroidPlatform: jest.fn(() => false), isApplePlatform: jest.fn(() => true), platformSelect: jest.fn((props) => props.android), })); jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({ isNavBarVisible: jest.fn(() => true), useRoute: jest.fn(() => ({ pathname: "/river/testId", })), useNavigation: jest.fn(() => ({ canGoBack: () => false, currentRoute: "/river/testId", data: { screen: { id: "testId" } }, videoModalState: { visible: false }, })), })); jest.mock("../utils", () => ({ playerDimensionsHack: {} })); const { PlayerWrapper } = require("../PlayerWrapper"); jest.useFakeTimers(); const children = jest.fn(() => {}); describe("PlayerWrapper", () => { it("renders properly", () => { mockUseIsDeviceTablet.mockReturnValue(false); const element = renderWithProviders( {children} ); expect(element).toMatchSnapshot(); }); it("renders inline", () => { mockUseIsDeviceTablet.mockReturnValue(false); const element = renderWithProviders( {children} ); expect(element).toMatchSnapshot(); }); it("renders inline on tablet in landscape orientation", () => { mockUseIsDeviceTablet.mockReturnValue(true); const element = renderWithProviders( {children} ); expect(element).toMatchSnapshot(); }); it("renders inline and docked", () => { mockUseIsDeviceTablet.mockReturnValue(false); const children = jest.fn(() => {}); const dimensions = { height: undefined, width: props.style.width }; const element = renderWithProviders( {children} ); expect(element).toMatchSnapshot(); }); });