Skip to content

Commit

Permalink
remove the abstraction for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Jun 21, 2023
1 parent 0265bc0 commit 0f358b3
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions packages/block-library/src/navigation/test/use-navigation-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { store as coreStore } from '@wordpress/core-data';
* Internal dependencies
*/
import useNavigationMenu from '../use-navigation-menu';
import { SELECT_NAVIGATION_MENUS_ARGS } from '../constants';

function createRegistryWithStores() {
// Create a registry and register used stores.
Expand All @@ -34,14 +33,26 @@ jest.mock( '@wordpress/data/src/components/use-select', () => {

function resolveRecords( registry, menus ) {
const dispatch = registry.dispatch( coreStore );
dispatch.startResolution(
'getEntityRecords',
SELECT_NAVIGATION_MENUS_ARGS
);
dispatch.finishResolution(
'getEntityRecords',
SELECT_NAVIGATION_MENUS_ARGS
);
dispatch.startResolution( 'getEntityRecords', [
'postType',
'wp_navigation',
{
per_page: 100,
status: [ 'publish', 'draft' ],
order: 'desc',
orderby: 'date',
},
] );
dispatch.finishResolution( 'getEntityRecords', [
'postType',
'wp_navigation',
{
per_page: 100,
status: [ 'publish', 'draft' ],
order: 'desc',
orderby: 'date',
},
] );
dispatch.receiveEntityRecords( 'postType', 'wp_navigation', menus, {
per_page: 100,
status: [ 'publish', 'draft' ],
Expand Down

0 comments on commit 0f358b3

Please sign in to comment.