From e5021187e96b78b53203bd95d08d6818aea47d17 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Wed, 14 Jul 2021 15:10:31 +0200 Subject: New Ignite 7.0.6 app --- test/mock-react-native-image.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/mock-react-native-image.ts (limited to 'test/mock-react-native-image.ts') diff --git a/test/mock-react-native-image.ts b/test/mock-react-native-image.ts new file mode 100644 index 0000000..eeae6bb --- /dev/null +++ b/test/mock-react-native-image.ts @@ -0,0 +1,20 @@ +import * as ReactNative from "react-native" +import mockFile from "./mock-file" + +jest.doMock("react-native", () => { + // Extend ReactNative + return Object.setPrototypeOf( + { + Image: { + ...ReactNative.Image, + resolveAssetSource: jest.fn((source) => mockFile), // eslint-disable-line @typescript-eslint/no-unused-vars + getSize: jest.fn(( + uri: string, // eslint-disable-line @typescript-eslint/no-unused-vars + success: (width: number, height: number) => void, + failure?: (error: any) => void, // eslint-disable-line @typescript-eslint/no-unused-vars + ) => success(100, 100)), + }, + }, + ReactNative, + ) +}) -- cgit v1.2.3