The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/packages/grafana-alerting/tests/test-utils.tsx

28 lines
996 B

/**
* ⚠ @TODO this will eventually be replaced with "@grafana/test-utils", consider helping out instead of adding things here!
*/
import { type RenderOptions, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { getDefaultWrapper, store } from './provider';
import '@testing-library/jest-dom';
/**
* Extended [@testing-library/react render](https://testing-library.com/docs/react-testing-library/api/#render)
* method which wraps the passed element in all of the necessary Providers,
* so it can render correctly in the context of the application
*/
const customRender = (ui: React.ReactNode, renderOptions: RenderOptions = {}) => {
const user = userEvent.setup();
const Providers = renderOptions.wrapper || getDefaultWrapper();
return {
renderResult: render(ui, { wrapper: Providers, ...renderOptions }),
user,
store,
};
};
export * from '@testing-library/react';
export { customRender as render, userEvent };