@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
25 lines (18 loc) • 570 B
JavaScript
import * as ReactNative from "react-native";
const mockDimensionsGet = jest.fn(
(type) =>
({
window: { width: 1, height: 1 },
screen: { width: 360, height: 540 },
})[type]
);
ReactNative.Dimensions.get = mockDimensionsGet;
const { Platform, Dimensions } = ReactNative;
Platform.OS = "web";
const { getInitialDimensions } = require("../getInitialDimensions.ts");
describe("useDimensions > helpers (web)", () => {
it("should call Dimensions.get", () => {
getInitialDimensions("window");
expect(Dimensions.get).toBeCalled();
});
});