mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 02:23:31 -06:00
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import '../annotations_srv';
|
|
import 'app/features/dashboard/time_srv';
|
|
import { AnnotationsSrv } from '../annotations_srv';
|
|
|
|
describe('AnnotationsSrv', function() {
|
|
const $rootScope = {
|
|
onAppEvent: jest.fn(),
|
|
};
|
|
let $q;
|
|
let datasourceSrv;
|
|
let backendSrv;
|
|
let timeSrv;
|
|
|
|
const annotationsSrv = new AnnotationsSrv($rootScope, $q, datasourceSrv, backendSrv, timeSrv);
|
|
|
|
describe('When translating the query result', () => {
|
|
const annotationSource = {
|
|
datasource: '-- Grafana --',
|
|
enable: true,
|
|
hide: false,
|
|
limit: 200,
|
|
name: 'test',
|
|
scope: 'global',
|
|
tags: ['test'],
|
|
type: 'event',
|
|
};
|
|
|
|
const time = 1507039543000;
|
|
const annotations = [{ id: 1, panelId: 1, text: 'text', time: time }];
|
|
let translatedAnnotations;
|
|
|
|
beforeEach(() => {
|
|
translatedAnnotations = annotationsSrv.translateQueryResult(annotationSource, annotations);
|
|
});
|
|
|
|
it('should set defaults', () => {
|
|
expect(translatedAnnotations[0].source).toEqual(annotationSource);
|
|
});
|
|
});
|
|
});
|