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/public/app/features/alerting/unified/components/GrafanaAlertmanagerDelivery...

48 lines
1.6 KiB

import { render } from '@testing-library/react';
import React from 'react';
import { AlertmanagerChoice } from '../../../../plugins/datasource/alertmanager/types';
import { GRAFANA_RULES_SOURCE_NAME } from '../utils/datasource';
import { GrafanaAlertmanagerDeliveryWarning } from './GrafanaAlertmanagerDeliveryWarning';
describe('GrafanaAlertmanagerDeliveryWarning', () => {
describe('When AlertmanagerChoice set to External', () => {
it('Should not render when the datasource is not Grafana', () => {
const { container } = render(
<GrafanaAlertmanagerDeliveryWarning
currentAlertmanager="custom-alertmanager"
alertmanagerChoice={AlertmanagerChoice.External}
/>
);
expect(container).toBeEmptyDOMElement();
});
it('Should render warning when the datasource is Grafana', () => {
const { container } = render(
<GrafanaAlertmanagerDeliveryWarning
currentAlertmanager={GRAFANA_RULES_SOURCE_NAME}
alertmanagerChoice={AlertmanagerChoice.External}
/>
);
expect(container).toHaveTextContent('Grafana alerts are not delivered to Grafana Alertmanager');
});
});
it.each([AlertmanagerChoice.All, AlertmanagerChoice.Internal])(
'Should not render when datasource is Grafana and Alertmanager choice is %s',
(choice) => {
const { container } = render(
<GrafanaAlertmanagerDeliveryWarning
currentAlertmanager={GRAFANA_RULES_SOURCE_NAME}
alertmanagerChoice={choice}
/>
);
expect(container).toBeEmptyDOMElement();
}
);
});