Skip to main content

mockBreakpoint()

Home > @backstage/test-utils > mockBreakpoint

Warning: This API is now obsolete.

Import from @backstage/core-components/testUtils instead.

This is a mocking method suggested in the Jest docs, as it is not implemented in JSDOM yet. It can be used to mock values for the Material UI useMediaQuery hook if it is used in a tested component.

For issues checkout the documentation: https://jestjs.io/docs/manual-mocks\#mocking-methods-which-are-not-implemented-in-jsdom

If there are any updates from Material UI React on testing useMediaQuery this mock should be replaced https://mui.com/material-ui/react-use-media-query/\#testing

Signature:

export default function mockBreakpoint(options: {
matches: boolean;
}): void;

Parameters

ParameterTypeDescription
options{ matches: boolean; }

Returns:

void