From 253b2cc081dc3fe2f81da2feb22b490f09494537 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Tue, 1 May 2018 05:00:56 +0900 Subject: [PATCH] add test for prometheus table column title --- .../prometheus/specs/result_transformer.jest.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts b/public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts index abcc46d7ea8..64b983fc8a7 100644 --- a/public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts +++ b/public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts @@ -47,6 +47,18 @@ describe('Prometheus Result Transformer', () => { { text: 'Value' }, ]); }); + + it('should column title include refId if response count is more than 2', () => { + var table = ctx.resultTransformer.transformMetricDataToTable(response.data.result, 2, "B"); + expect(table.type).toBe('table'); + expect(table.columns).toEqual([ + { text: 'Time', type: 'time' }, + { text: '__name__' }, + { text: 'instance' }, + { text: 'job' }, + { text: 'Value #B' }, + ]); + }); }); describe('When resultFormat is table and instant = true', () => {