From fb6c61c58463455e1a50fd0784a46fb9f56dd4d7 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 10 May 2024 16:08:39 +0100 Subject: [PATCH] Fix unit tests --- .../editor/src/components/page-attributes/test/order.js | 6 +++++- .../src/components/post-type-support-check/test/index.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/page-attributes/test/order.js b/packages/editor/src/components/page-attributes/test/order.js index 245cbbb8fc71db..fcb836bbfef0d3 100644 --- a/packages/editor/src/components/page-attributes/test/order.js +++ b/packages/editor/src/components/page-attributes/test/order.js @@ -22,7 +22,11 @@ jest.mock( '@wordpress/data/src/components/use-dispatch', () => ( { function setupDataMock( order = 0 ) { useSelect.mockImplementation( ( mapSelect ) => mapSelect( () => ( { - getPostType: () => null, + getPostType: () => ( { + supports: { + 'page-attributes': true, + }, + } ), getEditedPostAttribute: ( attr ) => { switch ( attr ) { case 'menu_order': diff --git a/packages/editor/src/components/post-type-support-check/test/index.js b/packages/editor/src/components/post-type-support-check/test/index.js index 8acef8abacb6b2..71b9f083a74a23 100644 --- a/packages/editor/src/components/post-type-support-check/test/index.js +++ b/packages/editor/src/components/post-type-support-check/test/index.js @@ -29,7 +29,7 @@ function setupUseSelectMock( postType ) { } describe( 'PostTypeSupportCheck', () => { - it( 'renders its children when post type is not known', () => { + it( 'does not render its children when post type is not known', () => { setupUseSelectMock( undefined ); const { container } = render( @@ -38,7 +38,7 @@ describe( 'PostTypeSupportCheck', () => { ); - expect( container ).toHaveTextContent( 'Supported' ); + expect( container ).not.toHaveTextContent( 'Supported' ); } ); it( 'does not render its children when post type is known and not supports', () => {