grafana/public/app/plugins/datasource/loki/configuration/AlertingSettings.test.tsx
Matias Chomicki 1b80df0168
Loki: add additional settings section (#71035)
* Loki: add additional settings section

* Derived fields: add config subsection

* Query settings: add config subsection

* Loki config: use divider instead of hr

* Derived fields: refactor legacy styles

* Loki config: add divider between derived fields and query settings

* Loki config: create alerting settings for Loki
2023-07-06 10:20:38 +02:00

24 lines
801 B
TypeScript

import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
import { createDefaultConfigOptions } from '../mocks';
import { AlertingSettings } from './AlertingSettings';
const options = createDefaultConfigOptions();
describe('AlertingSettings', () => {
it('should render', () => {
render(<AlertingSettings options={options} onOptionsChange={() => {}} />);
expect(screen.getByText('Alerting')).toBeInTheDocument();
});
it('should update alerting settings', async () => {
const onChange = jest.fn();
render(<AlertingSettings options={options} onOptionsChange={onChange} />);
await userEvent.click(screen.getByLabelText('Toggle switch'));
expect(onChange).toHaveBeenCalledTimes(1);
});
});