From 4ae999b90b2a67233890d30a8bff0dbdd58364f2 Mon Sep 17 00:00:00 2001 From: Cristian Matteu <94987118+ChrisMattew@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:20:32 -0700 Subject: [PATCH] Add `announceForAccessibilityWithOptions` method mock. (#47063) Summary: Currently, tests on components that use the `AccessibilityInfo.announceForAccessibilityWithOptions` method fail because a mock for this method is not present in the `jest` setup file. This PR adds the mock for the before mentioned method in the appropriate `setup.js` file ## Changelog: [General][Added] - Added the missing `announceForAccessibilityWithOptions` function mock in the `packages/react-native/jest/setup.js` file. Pull Request resolved: https://github.com/facebook/react-native/pull/47063 Test Plan: Here are the commands I executed after making the modification: - `yarn prettier` - `yarn lint` - `yarn test` ### Test output ![rn-tests-output](https://github.com/user-attachments/assets/81e9772e-37ce-43ad-9869-5f7f64c292f0) Reviewed By: tdn120 Differential Revision: D64495941 Pulled By: lunaleaps fbshipit-source-id: 6ab835e2934b87ec3ac64cf0aebd8dcb58cd0da1 --- packages/react-native/jest/setup.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/jest/setup.js b/packages/react-native/jest/setup.js index 667100ed83e..9714d2d73de 100644 --- a/packages/react-native/jest/setup.js +++ b/packages/react-native/jest/setup.js @@ -146,6 +146,7 @@ jest remove: jest.fn(), })), announceForAccessibility: jest.fn(), + announceForAccessibilityWithOptions: jest.fn(), isAccessibilityServiceEnabled: jest.fn(() => Promise.resolve(false)), isBoldTextEnabled: jest.fn(() => Promise.resolve(false)), isGrayscaleEnabled: jest.fn(() => Promise.resolve(false)),