mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
* Getting close * Restore angular app boot at startup * Moving angular annotations dependencies to app/angular or old graph * Remove redundant setLinkSrv call * Fixing graph test * Minor refactor based on review feedback * Create in get function
40 lines
1.0 KiB
TypeScript
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);
|
|
});
|
|
});
|