Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 10, 2024
1 parent b995c53 commit fb6c61c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/editor/src/components/page-attributes/test/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -38,7 +38,7 @@ describe( 'PostTypeSupportCheck', () => {
</PostTypeSupportCheck>
);

expect( container ).toHaveTextContent( 'Supported' );
expect( container ).not.toHaveTextContent( 'Supported' );
} );

it( 'does not render its children when post type is known and not supports', () => {
Expand Down

0 comments on commit fb6c61c

Please sign in to comment.