grafana/public/app/features/annotations/specs/annotations_srv_specs.test.ts
kay delaney ca3dff99e8
Chore: Bumps prettier version for new typescript syntax support (#20463)
* Chore: Bumps prettier version for new typescript syntax support

* Ran new version of prettier against the codebase
2019-11-19 13:59:39 +00:00

40 lines
1.0 KiB
TypeScript

import { dedupAnnotations } from '../events_processing';
describe('Annotations deduplication', () => {
it('should remove duplicated annotations', () => {
const testAnnotations = [
{ id: 1, time: 1 },
{ id: 2, time: 2 },
{ id: 2, time: 2 },
{ id: 5, time: 5 },
{ id: 5, time: 5 },
];
const expectedAnnotations = [
{ id: 1, time: 1 },
{ id: 2, time: 2 },
{ id: 5, time: 5 },
];
const deduplicated = dedupAnnotations(testAnnotations);
expect(deduplicated).toEqual(expectedAnnotations);
});
it('should leave non "panel-alert" event if present', () => {
const testAnnotations = [
{ id: 1, time: 1 },
{ id: 2, time: 2 },
{ id: 2, time: 2, eventType: 'panel-alert' },
{ id: 5, time: 5 },
{ id: 5, time: 5 },
];
const expectedAnnotations = [
{ id: 1, time: 1 },
{ id: 2, time: 2 },
{ id: 5, time: 5 },
];
const deduplicated = dedupAnnotations(testAnnotations);
expect(deduplicated).toEqual(expectedAnnotations);
});
});