From ea9708648434513cb543e00b745a2f4cff9570f5 Mon Sep 17 00:00:00 2001 From: machine424 Date: Fri, 15 Dec 2023 18:03:50 +0100 Subject: [PATCH] ui: create a reproduction for https://github.com/prometheus/prometheus/issues/13292 Signed-off-by: machine424 --- .../pages/graph/GraphHeatmapHelpers.test.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 web/ui/react-app/src/pages/graph/GraphHeatmapHelpers.test.ts diff --git a/web/ui/react-app/src/pages/graph/GraphHeatmapHelpers.test.ts b/web/ui/react-app/src/pages/graph/GraphHeatmapHelpers.test.ts new file mode 100644 index 000000000..dfc718587 --- /dev/null +++ b/web/ui/react-app/src/pages/graph/GraphHeatmapHelpers.test.ts @@ -0,0 +1,27 @@ +import { isHeatmapData } from './GraphHeatmapHelpers'; + +describe('GraphHeatmapHelpers', () => { + it('isHeatmapData should return false for a vector', () => { + const data = { + resultType: 'vector', + result: [ + { + metric: { + __name__: 'my_gauge', + job: 'target', + }, + value: [1703091180.683, '6'], + }, + ], + }; + expect(isHeatmapData(data)).toBe(false); + }); + + it('isHeatmapData should return false for scalar resultType', () => { + const data = { + resultType: 'scalar', + result: [1703091180.125, '1703091180.125'], + }; + expect(isHeatmapData(data)).toBe(false); + }); +});