From 932995b55cd9c5e7954c65d58ff2c5e1af329d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Mon, 6 Oct 2025 16:05:54 +0200 Subject: [PATCH] [jest-preset] Fix mock for Linking All three patched methods are supposed to return `Promise`. Having the mock return `undefined` for them breaks tests that expect the Promise. --- packages/react-native/jest/mocks/Linking.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-native/jest/mocks/Linking.js b/packages/react-native/jest/mocks/Linking.js index c558c824a14943..a9bb65e1afbfbc 100644 --- a/packages/react-native/jest/mocks/Linking.js +++ b/packages/react-native/jest/mocks/Linking.js @@ -9,12 +9,12 @@ */ const Linking = { - openURL: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, + openURL: jest.fn(() => Promise.resolve()) as JestMockFn<$FlowFixMe, $FlowFixMe>, canOpenURL: jest.fn(() => Promise.resolve(true)) as JestMockFn< $FlowFixMe, $FlowFixMe, >, - openSettings: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, + openSettings: jest.fn(() => Promise.resolve()) as JestMockFn<$FlowFixMe, $FlowFixMe>, addEventListener: jest.fn(() => ({ remove: jest.fn(), })) as JestMockFn<$FlowFixMe, $FlowFixMe>, @@ -22,7 +22,7 @@ const Linking = { $FlowFixMe, $FlowFixMe, >, - sendIntent: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, + sendIntent: jest.fn(() => Promise.resolve()) as JestMockFn<$FlowFixMe, $FlowFixMe>, }; export default Linking;