文件操作 - annotations_srv_specs.test.ts
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/features/annotations/specs/annotations_srv_specs.test.ts
编辑文件内容
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); }); });
修改文件时间
将文件时间修改为当前时间的前一年
删除文件