mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 21:27:46 +00:00
2aba3522ab
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: https://github.com/facebook/react-native/pull/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 |
||
---|---|---|
.. | ||
private | ||
assetFileTransformer.js | ||
mockComponent.js | ||
mockModal.js | ||
mockNativeComponent.js | ||
MockNativeMethods.js | ||
mockScrollView.js | ||
renderer.js | ||
setup.js |