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
35 lines
833 B
TypeScript
35 lines
833 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import React from 'react';
|
|
|
|
import { createLokiDatasource } from '../../mocks';
|
|
|
|
import { MonacoQueryFieldWrapper, Props } from './MonacoQueryFieldWrapper';
|
|
|
|
function renderComponent({
|
|
initialValue = '',
|
|
onChange = jest.fn(),
|
|
onRunQuery = jest.fn(),
|
|
runQueryOnBlur = false,
|
|
}: Partial<Props> = {}) {
|
|
const datasource = createLokiDatasource();
|
|
|
|
render(
|
|
<MonacoQueryFieldWrapper
|
|
datasource={datasource}
|
|
history={[]}
|
|
initialValue={initialValue}
|
|
onChange={onChange}
|
|
onRunQuery={onRunQuery}
|
|
runQueryOnBlur={runQueryOnBlur}
|
|
/>
|
|
);
|
|
}
|
|
|
|
describe('MonacoFieldWrapper', () => {
|
|
test('Renders with no errors', async () => {
|
|
renderComponent();
|
|
|
|
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
|
});
|
|
});
|