diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-07-14 15:10:31 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-07-14 15:10:31 +0200 |
commit | e5021187e96b78b53203bd95d08d6818aea47d17 (patch) | |
tree | 37ec45d00eb963db53cd4bb4f04a770414b351cc /test/mock-react-native-image.ts |
New Ignite 7.0.6 app
Diffstat (limited to 'test/mock-react-native-image.ts')
-rw-r--r-- | test/mock-react-native-image.ts | 20 |
1 files changed, 20 insertions, 0 deletions
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, + ) +}) |