mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Loki: Remember default editor * Loki: Add tests * Prometheus: Set default editor type * Fix and refactor tests * Remove unused import
23 lines
728 B
TypeScript
23 lines
728 B
TypeScript
import { QueryEditorMode } from '../../prometheus/querybuilder/shared/types';
|
|
|
|
import { changeEditorMode, getQueryWithDefaults } from './state';
|
|
|
|
describe('getQueryWithDefaults(', () => {
|
|
it('should set defaults', () => {
|
|
expect(getQueryWithDefaults({ refId: 'A' } as any)).toEqual({
|
|
editorMode: 'builder',
|
|
expr: '',
|
|
queryType: 'range',
|
|
refId: 'A',
|
|
});
|
|
});
|
|
|
|
it('changing editor mode with blank query should change default', () => {
|
|
changeEditorMode({ refId: 'A', expr: '' }, QueryEditorMode.Code, (query) => {
|
|
expect(query.editorMode).toBe(QueryEditorMode.Code);
|
|
});
|
|
|
|
expect(getQueryWithDefaults({ refId: 'A' } as any).editorMode).toEqual(QueryEditorMode.Code);
|
|
});
|
|
});
|