mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* 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>
31 lines
1.2 KiB
TypeScript
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();
|
|
});
|
|
});
|