From d66a4ce4a01f375cd6a3127ab56f9507af9e502c Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 16 Jan 2020 12:30:10 -0500 Subject: [PATCH] Block Editor: Mock useSelect by relative file import --- .../src/components/link-control/test/index.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/block-editor/src/components/link-control/test/index.js b/packages/block-editor/src/components/link-control/test/index.js index 28a1faf23923e..944018ba155e2 100644 --- a/packages/block-editor/src/components/link-control/test/index.js +++ b/packages/block-editor/src/components/link-control/test/index.js @@ -17,16 +17,9 @@ import { fauxEntitySuggestions, fetchFauxEntitySuggestions } from './fixtures'; const mockFetchSearchSuggestions = jest.fn(); -jest.mock( '@wordpress/data', () => { - return { - ...require.requireActual( '../../../../../data' ), - useSelect() { - return { - fetchSearchSuggestions: mockFetchSearchSuggestions, - }; - }, - }; -} ); +jest.mock( '@wordpress/data/src/components/use-select', () => () => ( { + fetchSearchSuggestions: mockFetchSearchSuggestions, +} ) ); /** * Wait for next tick of event loop. This is required