mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 09:33:34 -06:00
* 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
24 lines
801 B
TypeScript
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);
|
|
});
|
|
});
|