mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* call query stats with whole query * call stats when query type changes * fix stats request timerange * feedback: extract functions from component * feedback: remove "or string" types * feedback: use ds timerange picker end * partial: fix broken test * changes * update test comment * rename variable * add comment explain message prop * make getStatsTimeRange a datasource method * update tests for getStatsTimeRange * make getStats a datasource method * update failing tests * update failing tests * remove import * Update public/app/plugins/datasource/loki/datasource.test.ts Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> --------- Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
37 lines
890 B
TypeScript
37 lines
890 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import React from 'react';
|
|
|
|
import { createLokiDatasource } from '../../mocks';
|
|
|
|
import MonacoQueryField from './MonacoQueryField';
|
|
import { Props } from './MonacoQueryFieldProps';
|
|
|
|
function renderComponent({
|
|
initialValue = '',
|
|
onRunQuery = jest.fn(),
|
|
onBlur = jest.fn(),
|
|
onChange = jest.fn(),
|
|
}: Partial<Props> = {}) {
|
|
const datasource = createLokiDatasource();
|
|
|
|
render(
|
|
<MonacoQueryField
|
|
datasource={datasource}
|
|
initialValue={initialValue}
|
|
history={[]}
|
|
onRunQuery={onRunQuery}
|
|
onBlur={onBlur}
|
|
onChange={onChange}
|
|
placeholder="Enter a Loki query (run with Shift+Enter)"
|
|
/>
|
|
);
|
|
}
|
|
|
|
describe('MonacoQueryField', () => {
|
|
test('Renders with no errors', async () => {
|
|
renderComponent();
|
|
|
|
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
|
});
|
|
});
|