Annotations: Fix test name and reorder tests slightly
This commit is contained in:
@@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { GrafanaAnnotationType, GrafanaAnnotationQuery } from '../types';
|
||||
import AnnotationQueryEditor from './AnnotationQueryEditor';
|
||||
|
||||
describe('AnnotationQuery', () => {
|
||||
describe('AnnotationQueryEditor', () => {
|
||||
const mockOnChange = jest.fn();
|
||||
let mockQuery: GrafanaAnnotationQuery;
|
||||
|
||||
@@ -27,6 +27,20 @@ describe('AnnotationQuery', () => {
|
||||
expect(maxLimit).toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('when the query type is "Tags"', () => {
|
||||
it('has a "Match any" toggle', () => {
|
||||
render(<AnnotationQueryEditor query={mockQuery} onChange={mockOnChange} />);
|
||||
const matchAny = screen.getByLabelText('Match any');
|
||||
expect(matchAny).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('has a "Tags" input', () => {
|
||||
render(<AnnotationQueryEditor query={mockQuery} onChange={mockOnChange} />);
|
||||
const tags = screen.getByLabelText('Tags');
|
||||
expect(tags).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the query type is "Dashboard"', () => {
|
||||
beforeEach(() => {
|
||||
mockQuery.type = GrafanaAnnotationType.Dashboard;
|
||||
@@ -44,18 +58,4 @@ describe('AnnotationQuery', () => {
|
||||
expect(tags).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the query type is "Tags"', () => {
|
||||
it('has a "Match any" toggle', () => {
|
||||
render(<AnnotationQueryEditor query={mockQuery} onChange={mockOnChange} />);
|
||||
const matchAny = screen.getByLabelText('Match any');
|
||||
expect(matchAny).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('has a "Tags" input', () => {
|
||||
render(<AnnotationQueryEditor query={mockQuery} onChange={mockOnChange} />);
|
||||
const tags = screen.getByLabelText('Tags');
|
||||
expect(tags).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user