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 13, 2024
1 parent 9e72ea9 commit 9b68638
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 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 @@ -21,7 +21,11 @@ function setupDataMock( id, count ) {
getCurrentPostLastRevisionId: () => id,
getCurrentPostRevisionsCount: () => count,
getEditedPostAttribute: () => null,
getPostType: () => null,
getPostType: () => ( {
supports: {
revisions: true,
},
} ),
} ) )
);
}
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 9b68638

Please sign in to comment.