UNPKG

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

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

52 lines (40 loc) 1.45 kB
import { renderHook } from "@testing-library/react-hooks"; import { useDelayedPlayerDetails } from "../useDelayedPlayerDetails"; import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks"; jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({ useIsTablet: jest.fn().mockReturnValue(false), })); describe("useDelayedPlayerDetails", () => { beforeEach(() => { jest.clearAllMocks(); }); it("should return true initially", () => { const { result } = renderHook(() => useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false }) ); expect(result.current).toBe(true); }); it("should return false when isPip is true", () => { const { result } = renderHook(() => useDelayedPlayerDetails({ isInline: true, isDocked: true, isPip: true }) ); expect(result.current).toBe(false); }); it("should return false when isDocked is true", () => { const { result } = renderHook(() => useDelayedPlayerDetails({ isInline: true, isDocked: true, isPip: false }) ); expect(result.current).toBe(false); }); it("should return true for tablet regardless of other flags", () => { (useIsTablet as jest.Mock).mockReturnValue(true); const { result } = renderHook(() => useDelayedPlayerDetails({ isInline: false, isDocked: false, isPip: false, }) ); expect(result.current).toBe(true); }); });