Skip to content

Commit 90212ed

Browse files
committed
[jest-preset] Fix mock for Linking
All three patched methods are supposed to return `Promise<any>`. Having the mock return `undefined` for them breaks tests that expect the Promise.
1 parent 77332d2 commit 90212ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/jest-preset/jest/mocks/Linking.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
*/
1010

1111
const Linking = {
12-
openURL: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>,
12+
openURL: jest.fn(() => Promise.resolve()) as JestMockFn<$FlowFixMe, $FlowFixMe>,
1313
canOpenURL: jest.fn(() => Promise.resolve(true)) as JestMockFn<
1414
$FlowFixMe,
1515
$FlowFixMe,
1616
>,
17-
openSettings: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>,
17+
openSettings: jest.fn(() => Promise.resolve()) as JestMockFn<$FlowFixMe, $FlowFixMe>,
1818
addEventListener: jest.fn(() => ({
1919
remove: jest.fn(),
2020
})) as JestMockFn<$FlowFixMe, $FlowFixMe>,
2121
getInitialURL: jest.fn(() => Promise.resolve()) as JestMockFn<
2222
$FlowFixMe,
2323
$FlowFixMe,
2424
>,
25-
sendIntent: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>,
25+
sendIntent: jest.fn(() => Promise.resolve()) as JestMockFn<$FlowFixMe, $FlowFixMe>,
2626
};
2727

2828
export default Linking;

0 commit comments

Comments
 (0)