mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* feat(loki-query-validation): validation proof of concept * feat(loki-query-validation): refactor and properly display the error portion * feat(loki-query-validation): add support for multi-line queries * feat(loki-query-validation): improve display of linting errors to users * feat(loki-query-validation): add unit tests * Chore: remove unused import * wip * Revert "wip" This reverts commit 44896f7fa2d33251033f8c37776f4d6f2f43787d. * Revert "Revert "wip"" This reverts commit f7889f49a6b0bdc5a4b677e9bbb8c62ea3cccb74. * feat(loki-query-validation): parse original and interpolated query for better validation feedback * feat(loki-query-validation): refactor interpolated query validation support * feat(loki-query-validation): improve validation for interpolated queries
30 lines
771 B
TypeScript
30 lines
771 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() }: Partial<Props> = {}) {
|
|
const datasource = createLokiDatasource();
|
|
|
|
render(
|
|
<MonacoQueryField
|
|
datasource={datasource}
|
|
initialValue={initialValue}
|
|
history={[]}
|
|
onRunQuery={onRunQuery}
|
|
onBlur={onBlur}
|
|
/>
|
|
);
|
|
}
|
|
|
|
describe('MonacoQueryField', () => {
|
|
test('Renders with no errors', async () => {
|
|
renderComponent();
|
|
|
|
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
|
});
|
|
});
|