Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adjust clipboard mock (facebook#34672)
Summary: Currently, Clipboard's methods (setString, getString) can't be asserted when writing tests as the mock targeted `Libraries/BatchedBridge/NativeModules` instead of `Libraries/Components/Clipboard/Clipboard` that's used on react-native [entry point](https://github.com/facebook/react-native/blob/main/index.js#L270) so it won't be considered as `mock function`. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - Update `Clipboard` mock path Pull Request resolved: facebook#34672 Test Plan: ```js // App-test.js import { Clipboard } from 'react-native'; import React from 'react'; it('renders correctly', () => { Clipboard.setString('string'); expect(Clipboard.setString).toBeCalled(); }); ``` ### before <img width="473" alt="Screen Shot 2022-09-13 at 16 24 30" src="https://user-images.githubusercontent.com/5382429/189864957-6b926478-6781-4291-a1eb-4493779de1a2.png" /> ### after <img width="598" alt="Screen Shot 2022-09-13 at 16 26 34" src="https://user-images.githubusercontent.com/5382429/189865131-e7c39f97-1cc1-4eb9-b4c0-d9ddf7a05c9c.png" /> Reviewed By: yungsters Differential Revision: D39575916 Pulled By: cortinico fbshipit-source-id: 34a3f93986a18d349ac033bb13a10ed77689935c
- Loading branch information