grafana/public/app/features/explore/SupplementaryResultError.test.tsx
Ivana Huckova a0921f2e88
Explore: Implement logs sample in Explore (#61864)
* Implement log samples

* Explore: Implement logs sample panel

* Log samples: Add documentation

* Update docs

* Add info for log sample

* Fix label

* Update

* Default to true

* Fix copy in test

* Update public/app/features/explore/LogsSamplePanel.tsx

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

* Use timeZone from grafana/schema

* Rename data props to queryResponse

* Unify name to logs sample

* Remove redundant optional parameters in LogsSamplePanel

* Make intervalMs parameter optional in dataFrameToLogsModel and remove undefined argument when not needed

* Fix incorrect position of copy log line button

* Update public/app/core/logsModel.ts

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
2023-01-24 19:10:27 +01:00

31 lines
1.2 KiB
TypeScript

import { render, screen } from '@testing-library/react';
import React from 'react';
import { SupplementaryResultError } from './SupplementaryResultError';
describe('SupplementaryResultError', () => {
it('shows short warning message', () => {
const error = { data: { message: 'Test error message' } };
const title = 'Error loading supplementary query';
render(<SupplementaryResultError error={error} title={title} />);
expect(screen.getByText(title)).toBeInTheDocument();
expect(screen.getByText(error.data.message)).toBeInTheDocument();
});
it('shows long warning message', () => {
// we make a long message
const messagePart = 'One two three four five six seven eight nine ten.';
const message = messagePart.repeat(3);
const error = { data: { message } };
const title = 'Error loading supplementary query';
render(<SupplementaryResultError error={error} title={title} />);
expect(screen.getByText(title)).toBeInTheDocument();
expect(screen.queryByText(message)).not.toBeInTheDocument();
const button = screen.getByText('Show details');
button.click();
expect(screen.getByText(message)).toBeInTheDocument();
});
});