From 80d5ac610d3e296700ede00e16f0cbec56f1427f Mon Sep 17 00:00:00 2001 From: Harsh Date: Thu, 28 Mar 2024 10:15:32 +0530 Subject: [PATCH] added workaround for failing test case on expo-image --- __mocks__/expo-image.js | 8 ++ jest.setup.js | 13 +++ .../__snapshots__/EmptyVault.test.tsx.snap | 19 +--- .../__snapshots__/VaultCard.test.tsx.snap | 18 +--- .../__snapshots__/AboutScreen.test.tsx.snap | 20 +--- .../EmptyTransaction.test.tsx.snap | 19 +--- .../ConnectionBoundary.test.tsx.snap | 19 +--- .../PasscodePrompt.test.tsx.snap | 96 ++----------------- .../CreateWalletGuidelines.test.tsx.snap | 19 +--- .../WalletCreateRestoreSuccess.test.tsx.snap | 38 +------- 10 files changed, 43 insertions(+), 226 deletions(-) create mode 100644 __mocks__/expo-image.js diff --git a/__mocks__/expo-image.js b/__mocks__/expo-image.js new file mode 100644 index 0000000000..1df672fe31 --- /dev/null +++ b/__mocks__/expo-image.js @@ -0,0 +1,8 @@ +import { + Image as RNImage, + ImageBackground as RNImageBackground, +} from 'react-native'; + +// TODO remove when https://github.com/expo/expo/issues/26087 is resolved +export const ImageBackground = RNImageBackground; +export const Image = RNImage; \ No newline at end of file diff --git a/jest.setup.js b/jest.setup.js index b1769278c6..e46f028ce9 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -8,3 +8,16 @@ jest.mock("expo-linking", () => { return module; }); + +global.window.matchMedia = global.matchMedia || function (query) { + return { + matches: false, + media: query, + onchange: null, + addListener: jest.fn(), // deprecated + removeListener: jest.fn(), // deprecated + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + dispatchEvent: jest.fn(), + }; +} diff --git a/mobile-app/app/screens/AppNavigator/screens/Loans/components/__snapshots__/EmptyVault.test.tsx.snap b/mobile-app/app/screens/AppNavigator/screens/Loans/components/__snapshots__/EmptyVault.test.tsx.snap index 3893de09ac..3a068070d2 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Loans/components/__snapshots__/EmptyVault.test.tsx.snap +++ b/mobile-app/app/screens/AppNavigator/screens/Loans/components/__snapshots__/EmptyVault.test.tsx.snap @@ -58,29 +58,14 @@ exports[`Empty vault should match snapshot 1`] = ` } } > - - should match snapshot 1`] = ` /> - should match snapshot 1`] = ` "width": 256, } } - transition={null} - width={256} /> - - -`; +exports[`transaction authorization screen should match snapshot of status: 0 1`] = `null`; -exports[`transaction authorization screen should match snapshot of status: 1 1`] = ` - -`; +exports[`transaction authorization screen should match snapshot of status: 1 1`] = `null`; -exports[`transaction authorization screen should match snapshot of status: 2 1`] = ` - -`; +exports[`transaction authorization screen should match snapshot of status: 2 1`] = `null`; -exports[`transaction authorization screen should match snapshot of status: 3 1`] = ` - -`; +exports[`transaction authorization screen should match snapshot of status: 3 1`] = `null`; -exports[`transaction authorization screen should match snapshot of status: 4 1`] = ` - -`; +exports[`transaction authorization screen should match snapshot of status: 4 1`] = `null`; -exports[`transaction authorization screen should match snapshot of status: 5 1`] = ` - -`; +exports[`transaction authorization screen should match snapshot of status: 5 1`] = `null`; diff --git a/mobile-app/app/screens/WalletNavigator/screens/CreateWallet/__snapshots__/CreateWalletGuidelines.test.tsx.snap b/mobile-app/app/screens/WalletNavigator/screens/CreateWallet/__snapshots__/CreateWalletGuidelines.test.tsx.snap index 72712feaf7..fc78c80113 100644 --- a/mobile-app/app/screens/WalletNavigator/screens/CreateWallet/__snapshots__/CreateWalletGuidelines.test.tsx.snap +++ b/mobile-app/app/screens/WalletNavigator/screens/CreateWallet/__snapshots__/CreateWalletGuidelines.test.tsx.snap @@ -33,29 +33,14 @@ exports[`create wallet guidelines v2 should match snapshot 1`] = ` } } > - - -