From 663614f3c686b48a29a3805de9d2fb86695d0544 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Mon, 25 Nov 2024 13:40:57 -0600 Subject: [PATCH] fix test --- .../app/plugins/panel/timeseries/utils.test.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/app/plugins/panel/timeseries/utils.test.ts b/public/app/plugins/panel/timeseries/utils.test.ts index 78af574e426..079022d0232 100644 --- a/public/app/plugins/panel/timeseries/utils.test.ts +++ b/public/app/plugins/panel/timeseries/utils.test.ts @@ -1,7 +1,9 @@ -import { createTheme, FieldType, createDataFrame, toDataFrame } from '@grafana/data'; +import { createTheme, FieldType, createDataFrame, toDataFrame, FieldConfigSource } from '@grafana/data'; import { prepareGraphableFields } from './utils'; +const fieldConfig: FieldConfigSource = { defaults: {}, overrides: [] }; + describe('prepare timeseries graph', () => { it('errors with no time fields', () => { const input = [ @@ -12,7 +14,7 @@ describe('prepare timeseries graph', () => { ], }), ]; - const frames = prepareGraphableFields(input, createTheme()); + const frames = prepareGraphableFields(input, fieldConfig, createTheme()); expect(frames).toBeNull(); }); @@ -25,7 +27,7 @@ describe('prepare timeseries graph', () => { ], }), ]; - const frames = prepareGraphableFields(input, createTheme()); + const frames = prepareGraphableFields(input, fieldConfig, createTheme()); expect(frames).toBeNull(); }); @@ -41,7 +43,7 @@ describe('prepare timeseries graph', () => { ], }), ]; - const frames = prepareGraphableFields(input, createTheme()); + const frames = prepareGraphableFields(input, fieldConfig, createTheme()); expect(frames![0].fields.map((f) => f.state?.seriesIndex)).toEqual([undefined, undefined, 0, undefined, 1]); }); @@ -56,7 +58,7 @@ describe('prepare timeseries graph', () => { ], }), ]; - const frames = prepareGraphableFields(input, createTheme()); + const frames = prepareGraphableFields(input, fieldConfig, createTheme()); const out = frames![0]; expect(out.fields.map((f) => f.name)).toEqual(['a', 'b', 'c', 'd']); @@ -82,7 +84,7 @@ describe('prepare timeseries graph', () => { { name: 'a', values: [-10, NaN, 10, -Infinity, +Infinity] }, ], }); - const frames = prepareGraphableFields([df], createTheme()); + const frames = prepareGraphableFields([df], fieldConfig, createTheme()); const field = frames![0].fields.find((f) => f.name === 'a'); expect(field!.values).toMatchInlineSnapshot(` @@ -103,7 +105,7 @@ describe('prepare timeseries graph', () => { { name: 'a', values: [1, 2, 3] }, ], }); - const frames = prepareGraphableFields([df], createTheme()); + const frames = prepareGraphableFields([df], fieldConfig, createTheme()); const field = frames![0].fields.find((f) => f.name === 'a'); expect(field!.values).toMatchInlineSnapshot(` @@ -127,7 +129,7 @@ describe('prepare timeseries graph', () => { { name: 'a', config: { noValue: '20' }, values: [1, 2, 3] }, ], }); - const frames = prepareGraphableFields([df], createTheme()); + const frames = prepareGraphableFields([df], fieldConfig, createTheme()); const field = frames![0].fields.find((f) => f.name === 'a'); expect(field!.values).toMatchInlineSnapshot(`