From 890316c1057d6c238067c205899fa6dc25943a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Thu, 29 Jun 2023 14:53:31 +0200 Subject: [PATCH] logs: add more tests (#70886) --- .../logs/components/logParser.test.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/public/app/features/logs/components/logParser.test.ts b/public/app/features/logs/components/logParser.test.ts index 474f8cbe630..8c1c18048f7 100644 --- a/public/app/features/logs/components/logParser.test.ts +++ b/public/app/features/logs/components/logParser.test.ts @@ -49,6 +49,34 @@ describe('logParser', () => { expect(fields.find((field) => field.keys[0] === 'labels')).not.toBe(undefined); }); + it('should not filter out field with labels name and other type and datalinks', () => { + const logRow = createLogRow({ + entryFieldIndex: 10, + dataFrame: new MutableDataFrame({ + refId: 'A', + fields: [ + testStringField, + { + name: 'labels', + type: FieldType.other, + config: { + links: [ + { + title: 'test1', + url: 'url1', + }, + ], + }, + values: [{ place: 'luna', source: 'data' }], + }, + ], + }), + }); + const fields = getAllFields(logRow); + expect(fields.length).toBe(2); + expect(fields.find((field) => field.keys[0] === 'labels')).not.toBe(undefined); + }); + it('should filter out field with id name', () => { const logRow = createLogRow({ entryFieldIndex: 10,